Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const uuidv1 = require('uuid/v1'); const logger = require('../../services/logger'); module.exports = function(app) { const remotes = app.remotes(); remotes.options.rest = remotes.options.rest || {} remotes.options.rest.handleErrors = false; function FinalErrorHandler(err, req, res, next) { const errorId = uuidv1(); logger.error(`Message: ${err.message}, ErrorId: ${errorId}`); res.status(err.statusCode).send({ message: err.message, ErrorId: errorId, name: err.name ? err.name : '' }).end(); } app.middleware('final', FinalErrorHandler); } |