How to display separate page if quota is exceeded?
-
12-12-2019 - |
Question
I do it in accordance with Custom Error Responses - app.yaml is updated with
error_handlers:
- error_code: over_quota
file: templates/over_quota.html
and according file is created. But still error (exception) is shown instead of that page. I've tried to place the file in the root folder (with according update at app.yaml) - it didn't help.
What am I doing wrong?
Upd. I've defined that in the following way in accordance with @Gwyn Howell comment.
handlers:
- url: /over_quota.html
static_files: templates/over_quota.html
upload: templates/over_quota.html
error_handlers:
- error_code: over_quota
file: over_quota.html
But (1) how to test it, (2) which url user will see in result? http://www.example.com/over_quota.html
or will it be original url?
Solution
You're going over a specific quota, such as datastore operations, which throws an exception, without going over your instance hours quota. The over quota error message is only shown if App Engine can't send a request to an instance at all due to lack of quota; if the request is sent to your app, but you attempt to do something that exceeds available quota, it's up to you to handle the exception as you see fit.