DEV Community

Discussion on: Flask Rest API -Part:4- Exception Handling

Collapse
 
bisscay profile image
Bissallah Ekele • Edited

Great implementation!

One quick note, you can avoid handling your exceptions with try-catch by extending the HTTPException class.
FlaskRESTful will handle these exceptions for you.

Secondly, you can avoid defining a 'pass' in error classes like InternalServerError, seeing the it already exists in Werkzeug.
FlaskRESTful will access your errors dictionary and display your JSON.

Lovely read once again, you improved my understanding.
Cheers.