You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While @validate_request do wonders! it also caps some important information.
When a malformed input comes, it of course fails returning Bad Request.. but there is no way to get to know about it.
I'd like to log the malformed input, because maybe it is my client API that is sending it wrong, I'd like to know in which field is the problem, maybe I'd like to push it to Prometheus/Grafana, others might like to report to a Slack Channel because it might be due to an incompatibility due to a regression in the consumer side etc..
My suggestion is to accept an additional parameter, as shown:
Personally, i find that defining app.errorhandler work fine here, whether you are using a blueprint setup or just a single app.
Here's sample code i use.
You can have the function do whatever you want with the error message, such as extra formatting. My code assumes you have BaseResponse model defined, else you can just use jsonify. Also, i am running python3.10.
While
@validate_request
do wonders! it also caps some important information.When a malformed input comes, it of course fails returning Bad Request.. but there is no way to get to know about it.
I'd like to log the malformed input, because maybe it is my client API that is sending it wrong, I'd like to know in which field is the problem, maybe I'd like to push it to Prometheus/Grafana, others might like to report to a Slack Channel because it might be due to an incompatibility due to a regression in the consumer side etc..
My suggestion is to accept an additional parameter, as shown:
Thx!
The text was updated successfully, but these errors were encountered: