Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

The API has a Throttle on the number of requests you can make. So we queue our requests in a local database and make as many requests as possible until the "Throttle exception" is thrown. Upon catching we exit the program and a scheduled task starts the process over again in 15 minutes.

Is it standard to log this type of exception or just exit the program since this exception is expected

share|improve this question

marked as duplicate by gnat, GlenH7, MichaelT, ChrisF Dec 7 '13 at 13:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You don't get an "amount of requests left" message with the normal responses? That would even prevent the exception. – Luc Franken Dec 5 '13 at 14:19
We dont. I was suprised by this. – Man Dec 5 '13 at 14:36
We are told in the API Documentation how many requests you can make in a given time. But we figured that value may change in the future so it would be bad to code it as a constant. – Man Dec 5 '13 at 15:12
Why exit? Why not just sleep for 60 seconds, or however long it is until your throttle timer resets? – Bill Michell Dec 5 '13 at 17:20
up vote 6 down vote accepted

I'd log (at info level) the reason I was exiting the program, though not the stack trace. I might log at debug level the details of the thrown exception, and configure debug logging off in production but on when in my IDE.

Having programs exit without obvious reason is just plain wrong. Your support team will curse you every time – or maybe start ignoring it when the program exits for some other reason, because they will assume that it is for the reason they know about.

And developers always want all the information – and know how to disable it if they don't care at the moment.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.