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. 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.. Commented Sep 18, 2013 at 9:45
  • salesforce.com/us/developer/docs/pages/Content/… Commented Oct 18, 2013 at 10:02

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.. Commented Sep 18, 2013 at 9:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.