Skip to main content
Updated link
Source Link
Doug B
  • 11.5k
  • 1
  • 37
  • 44

You cannot catch Limit exceptions.

The best you can do is use the Limits methods to test when you are approaching the limits and act accordingly (for example stop further processing and record an error).

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Limits_static_methods.htmhttps://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm

For example

if (Limits.getLimitQueries() > 0) {
  //do your query
} else {
  //handle this error situation
}

You cannot catch Limit exceptions.

The best you can do is use the Limits methods to test when you are approaching the limits and act accordingly (for example stop further processing and record an error).

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Limits_static_methods.htm

You cannot catch Limit exceptions.

The best you can do is use the Limits methods to test when you are approaching the limits and act accordingly (for example stop further processing and record an error).

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_limits.htm

For example

if (Limits.getLimitQueries() > 0) {
  //do your query
} else {
  //handle this error situation
}
Source Link
Doug B
  • 11.5k
  • 1
  • 37
  • 44

You cannot catch Limit exceptions.

The best you can do is use the Limits methods to test when you are approaching the limits and act accordingly (for example stop further processing and record an error).

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_Limits_static_methods.htm