Storz
Storz copied to clipboard
Fix Error Handlers and handling
The error handler and how errors are handled need to be fixed.
- The global error handler has an issue. To reproduce the error, once the server is running visit a route that does not exist, and the request will hang on until the server timeout. Example: visit:
http://localhost:8080/api/user
orhttp://localhost:8080/this-does-not-exist
- Asynchronous errors need to be handled: currently on the route
try ... catch
were used to hand asynchronous errors. We can get rid of it and make the code more cleaner and maintainable. This way once can 'throw new Error' and it would be handled, also an unhandled exception would be captured. This will help us remove multipletry...catch
in all the route handlers.
@anomic30 please check this out and assigned it to me.
@anomic30 If I am to do this, then the existing error handling code may have to move to middleware/ because that is what it is.
Assigned @ezehlivinus