meteor-rest
meteor-rest copied to clipboard
JSON Error Handler shouldn't swallow errors without logging
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'
.
workaround, just specify the handler for specific path prefixes:
JsonRoutes.ErrorMiddleware.use('/methods/', RestMiddleware.handleErrorAsJson);
JsonRoutes.ErrorMiddleware.use('/users/', RestMiddleware.handleErrorAsJson);