Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[formrecognizer] raise exception when call quota volume exceeded #20042

Closed
kristapratico opened this issue Aug 2, 2021 · 0 comments · Fixed by #20062
Closed

[formrecognizer] raise exception when call quota volume exceeded #20042

kristapratico opened this issue Aug 2, 2021 · 0 comments · Fixed by #20062

Comments

@kristapratico
Copy link
Member

The service will return a Retry-After header that can be up to 3 days and our azure-core retry policy will honor it and wait... this gives the feel of the call hanging forever. We can improve the customer experience by inserting a custom policy that will check for indicators of the quota being exceeded (code, message) and raise an HttpResponseError immediately. Laurent's sample code for example:

So you can do a SansIOHTTPPolicy like:

def on_response(pipeline_response):
   response = pipeline_response.response
   if response.status_code == 403 and "Out of call volume quota for FormRecognizer F0 pricing tier" in response.text():
       raise QuotaReachedError(response.text(), response=response)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant