From 1e9afb398c11609009f70aede6406b1b1e7e0f77 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Fri, 26 Feb 2016 10:10:26 +0000 Subject: [PATCH] also support oldclient and rename method to "on" --- plugins/c9.error/error_handler.js | 6 ++---- plugins/c9.error/raygun.connect.js | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/plugins/c9.error/error_handler.js b/plugins/c9.error/error_handler.js index 5e9b40c0..bb582236 100644 --- a/plugins/c9.error/error_handler.js +++ b/plugins/c9.error/error_handler.js @@ -115,7 +115,7 @@ function plugin(options, imports, register) { var accept = req.headers.accept || ''; if (statusCode == 500) { - emitter.emit("serverError", { + emitter.emit("internalServerError", { err: err, req: req }); @@ -169,9 +169,7 @@ function plugin(options, imports, register) { register(null, { "connect.error": { - onInternalServerError: function(handler) { - emitter.on("serverError", handler); - } + on: emitter.on.bind(emitter) } }); } diff --git a/plugins/c9.error/raygun.connect.js b/plugins/c9.error/raygun.connect.js index 67f65baf..512be225 100644 --- a/plugins/c9.error/raygun.connect.js +++ b/plugins/c9.error/raygun.connect.js @@ -23,13 +23,9 @@ function plugin(options, imports, register) { var connectError = imports["connect.error"]; var server = imports.http.getServer(); - var noInternalServerErrors = !!options.noInternalServerErrors; - - if (!noInternalServerErrors) { - connectError.onInternalServerError(function(msg) { - sendRequestError(msg.err, msg.req); - }); - } + connectError.on("internalServerError", function(msg) { + sendRequestError(msg.err, msg.req); + }); errorClient.user = warningClient.user = function(req) { return (req && req.user) ? req.user.name : "";