You need to sign in to do that
Don't have an account?
SalesRed
Try Catch For Database.getQueryLocator(query) Exception
Hello,
I have the following code in an Apex Batch Apex Class.
try{
return Database.getQueryLocator(query);
}catch(Exception ex){
return null;
}
However I cannot seem to catch an exception if an invalid query is provided. I receive the following error
System.UnexpectedException: Start did not return a valid iterable object..
If I try to catch the System.UnexpectedException I still receive an error.
Should a try/catch not work in this scenario?
Thanks in advance for any help.
I have the following code in an Apex Batch Apex Class.
try{
return Database.getQueryLocator(query);
}catch(Exception ex){
return null;
}
However I cannot seem to catch an exception if an invalid query is provided. I receive the following error
System.UnexpectedException: Start did not return a valid iterable object..
If I try to catch the System.UnexpectedException I still receive an error.
Should a try/catch not work in this scenario?
Thanks in advance for any help.
try{
return iterable object;//this is correct with your existing code
}catch(Exception x){
System.debug(Error Message);
return iterable object;
}
All Answers
Thanks for your help.
try{
return iterable object;//this is correct with your existing code
}catch(Exception x){
System.debug(Error Message);
return iterable object;
}