Merge pull request #80 from jdextraze/jdextraze/simple-queued-handler-log-issue

Fix error with logging in SimpleQueuedHandler handler
This commit is contained in:
Nicolas Dextraze 2019-06-06 12:16:53 -07:00 committed by GitHub
commit 9e31b17c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,11 +13,12 @@ function SimpleQueuedHandler(log) {
SimpleQueuedHandler.prototype.registerHandler = function(type, handler) { SimpleQueuedHandler.prototype.registerHandler = function(type, handler) {
var typeId = typeName(type); var typeId = typeName(type);
var log = this._log;
this._handlers[typeId] = function (msg) { this._handlers[typeId] = function (msg) {
try { try {
handler(msg); handler(msg);
} catch(e) { } catch(e) {
this._log.error('handle for', type, 'failed:', e.stack); log.error('handle for', type, 'failed:', e.stack);
} }
}; };
}; };