6

I am getting this limit exception : System.LimitException:Too many callouts: 11

when I make a callout as this exception can not be catch, can someone help me how to handle this exception on visualforce page

any help will be appreciated.. Thanks

5
  • Can you share some of your (controller) code - like where you are performing the callouts ? You'll most likely need to change your implementation design. Commented Sep 18, 2013 at 9:22
  • I made a callout after 1 second on KeyUp event so if user press keys more than 10, it throws this error.
    – Mahi
    Commented Sep 18, 2013 at 9:33
  • You could keep track of your callouts, and limit them when you're at 9 if this is all in one VF view context. Alternativly you could process every keyUp with remote Javascript which will give you a fresh set of governor limits for its execution. Commented Sep 18, 2013 at 9:40
  • thanks for the help.. can you provide me some code for remote javascript..
    – Mahi
    Commented Sep 18, 2013 at 9:45

1 Answer 1

9

You cannot catch limit exceptions. Instead you need to prevent causing one. You can use the Limits class methods to find out how many callouts you have remaining.

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

Call Limits.getLimitCallouts() and check that this is greater than 0 before making a callout.

As Sdry has said, it sounds like you may need to refactor your design

1
  • Thanks for the help.. I try it, if it is helpful to me..
    – Mahi
    Commented Sep 18, 2013 at 9:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .