This PR adds errors middleware for capturing errors that occur inside all routes.
This is just the initial structure, going forward it should be trivial to add other common http errors (401s, 403s, 404s etc...)
To avoid wrapping all route handlers with try / catches I addedexpress-promise-router, which captures unresolved promises and passes the error to the middleware.
I also added child-process-promise to clean up the dash-cli command execution.
There is a TODO to complete when we add logging. Typically in production you don't want to pass stack traces to the client nor error messages with >500 code because they likely contain sensitive info about the code.
This PR adds errors middleware for capturing errors that occur inside all routes.
This is just the initial structure, going forward it should be trivial to add other common http errors (401s, 403s, 404s etc...)
To avoid wrapping all route handlers with try / catches I added
express-promise-router
, which captures unresolved promises and passes the error to the middleware.I also added
child-process-promise
to clean up the dash-cli command execution.There is a TODO to complete when we add logging. Typically in production you don't want to pass stack traces to the client nor error messages with >500 code because they likely contain sensitive info about the code.