How to use the errorHandler function from raven

Find comprehensive JavaScript raven.errorHandler code examples handpicked from public code repositorys.

45
46
47
48
49
50
51
52
53
54
 * Returns a Sentry error handler in case
 * Sentry client is set up.
 */
exports.errorHandler = () => {
  if (SENTRY_DSN) {
    return Raven.errorHandler();
  } else {
    return (err, req, res, next) => {
      next(err);
    };
fork icon958
star icon0
watch icon4

11
12
13
14
15
16
17
18
19
20

function errorHandler(options) {
        options = defaultOptions(options);

        // Handler for sending errors to Sentry
        const ravenErrorHandler = raven.errorHandler();

        // Handler for rendering to the user
        function standardErrorHandler(error, request, response) {
                const ft = request.app.ft;
fork icon2
star icon2
watch icon32

71
72
73
74
75
76
77
78
79
80
// Support for the legacy captureError function.
raven.captureError = raven.captureException.bind(raven);

module.exports = raven;

const _errorHandler = raven.errorHandler.bind(raven);
module.exports.errorHandler = function () {
        const middleware = _errorHandler();
        return (err, req, res, next) => {
                if (!res.locals.suppressRavenLogger) {
fork icon2
star icon1
watch icon89

+ 3 other calls in file

30
31
32
33
34
35
36
37
38
39

    if (!Raven.installed) {
      return next(err)
    }

    return Raven.errorHandler()(err, req, res, next)
  }
}

module.exports = {
fork icon0
star icon0
watch icon2