Seventy-two: About errorhandler hook function hook function of the flask

 

errorhandler:
in the event of some abnormality, such as 404, 500, if you want to customize handle these errors can be processed using errorhandler using errorhandler points to note:
1. In errorhandler decorative hook function, to return the corresponding status code
2. errorhandler decorative hook function, it is necessary to write a position parameter, for receiving an error message, if there is no writing position parameter, an error is reported
3. flask.abort manually throw some errors, such parameters are found when the problem, you can manually throw a 400 error, and then let the good defined 400 error handling logic to handle

 

500 error

 

404 Error

 

abort conjunction with errorhandler

 

Guess you like

Origin www.cnblogs.com/zhongyehai/p/11874509.html