Roman Mazur 8b4c9837fa
Unify API errors processing
With this change, we define a custom error handler as express middleware
which renders 503 error with JSON response that includes status and message
fields.

The handler also logs the error, so the stack can be inspected in supervisor
logs. It's also a point where we can report the error to analytics services.

This removes a bunch of error handlers written in every request handler
function. Behaviour should remain unchanged except the fact that
/healthy endpoint now returns 503 in case of failure instead of 500.

Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
2019-09-23 17:20:38 +03:00
..
2019-09-23 17:20:38 +03:00
2019-08-21 15:02:05 +01:00
2019-09-23 17:20:38 +03:00
2019-01-23 16:30:43 +00:00
2019-09-23 17:20:38 +03:00