I am using a API with a limit, there is a high possibility that I could hit the limit.

I am wondering how people handle this? Do they check if they hit the limit and then throw an exception? If so what type of exception?

Are there any best practices?

I am able to see if I hit the limit like below:

if (!string.IsNullOrEmpty(result.error))
       // we have hit a limit

This API is used for a MVC application. I am caching the ActionResult methods with the API content ([OutputCache]). If the Action method does not recieve the API result then the view will be empty, but if i throw something it will end up on the custom errors page.

Related posts

Recent Viewed