meteor-rest icon indicating copy to clipboard operation
meteor-rest copied to clipboard

JSON Error Handler shouldn't swallow errors without logging

Open johanbrook opened this issue 9 years ago • 1 comments

JSON Error Handler is an awesome drop-in, but we're having a hard time tracing server errors in development when using this package, since it catches all exceptions/errors and just outputs a default JSON response.

If one isn't scoping this middleware to a certain route, this package will swallow all errors in the whole app.

I propose that the package should log errors to stdout, at least when process.env.NODE_ENV === 'development'.

johanbrook avatar Jan 30 '16 20:01 johanbrook

workaround, just specify the handler for specific path prefixes:

JsonRoutes.ErrorMiddleware.use('/methods/', RestMiddleware.handleErrorAsJson);
JsonRoutes.ErrorMiddleware.use('/users/', RestMiddleware.handleErrorAsJson);

zeroasterisk avatar Aug 22 '16 23:08 zeroasterisk