tasking-manager icon indicating copy to clipboard operation
tasking-manager copied to clipboard

Improve error handling on backend

Open Aadesh-Baral opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. After the introduction of error subcode on #5039, the error handling on the backend is quite messed up.

Describe the solution you'd like To fix this issue we can use the custom error handling method defined on https://github.com/flask-restful/flask-restful/issues/221 instead of using try: except: everywhere to handle errors.

Describe alternatives you've considered There is an issue in #2951 to replace flask restful library as it's no longer maintained, so maybe we can think of replacing flask restful with Flask itself or with FastAPI as mentioned in #2283.

Aadesh-Baral avatar Jun 27 '22 10:06 Aadesh-Baral

I would like to solve this issue. Kindly assign this task to me.

joanjeremiah avatar Oct 01 '22 07:10 joanjeremiah

@joanjeremiah feel free to work on this.

Aadesh-Baral avatar Oct 01 '22 13:10 Aadesh-Baral

@tsmock can you take a look here and provide the team some feedback on this error handling scheme under proposal?

Bonkles avatar Jul 31 '23 14:07 Bonkles

My first response is "LGTM". I spent quite a bit of time tracking down errors when the stack traces weren't being printed, and it looks like #5899 will help fix that once they move over to the specific exceptions.

Beyond that:

  • I like that they are using a single base class for all TM exceptions (makes it easy to "catch" if we really need to)
  • Not really certain about loading error messages in __init__.py -- I would be surprised if it was loaded multiple times if the error messages were loaded in exceptions.py. I'd have to run it through a debugger though.

tsmock avatar Jul 31 '23 15:07 tsmock