also support oldclient and rename method to "on"

pull/263/head
Fabian Jakobs 2016-02-26 10:10:26 +00:00
rodzic d93801214b
commit 1e9afb398c
2 zmienionych plików z 5 dodań i 11 usunięć

Wyświetl plik

@ -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)
}
});
}

Wyświetl plik

@ -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 : "";