You need to sign in to do that
Don't have an account?
Why can't I catch this system exception?
So I have a SOQL query in a Visualforce page that is returning too many results. This is expected but I would like to be able to catch this error and display a nice clean error message to the user. The problem is that I can't seem to catch this error:
Error:
System.Exception: Too many query rows: 10001
Class.salesWinsVF.search: line 57, column 32
External entry point
Code:
Message Edited by TehNrd on 08-25-2008 10:53 AM
Error:
System.Exception: Too many query rows: 10001
Class.salesWinsVF.search: line 57, column 32
External entry point
Code:
Code:
try{ for(Opportunity opp : Database.query(queryString)){ results.add(opp); } }catch (QueryException e){ system.debug('Why can't I catch this'); } I've also tried: }catch (Exception e){ with no luck.
Message Edited by TehNrd on 08-25-2008 10:53 AM
I guess I will just have to limit the results to 10,000 and then check to see if this was reached and then notify the user.
Thanks for the help.
-Jason
Message Edited by TehNrd on 08-27-2008 11:37 AM
for example, getQueryRows() and getLimitQueryRows() .
or search for "Limit Methods" in the doc.