From 612d9eeb2332ccec271ad56f90411293e18ce19c Mon Sep 17 00:00:00 2001 From: csausdev Date: Sat, 11 Dec 2010 21:59:50 +1100 Subject: [PATCH] small tweak to exception handling --- lib/log4js.js | 2 +- package.json | 2 +- test/logging.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/log4js.js b/lib/log4js.js index a840be2..8e88217 100644 --- a/lib/log4js.js +++ b/lib/log4js.js @@ -284,7 +284,7 @@ module.exports = function (fileSystem, standardOutput, configPaths) { if (exception && exception.message && exception.name) { this.exception = exception; } else if (exception) { - this.exception = new Error(exception); + this.exception = new Error(sys.inspect(exception)); } } diff --git a/package.json b/package.json index 3ad42ae..b2eb3e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "log4js", - "version": "0.2.1", + "version": "0.2.2", "description": "Port of Log4js to work with node.", "keywords": [ "logging", diff --git a/test/logging.js b/test/logging.js index 8e15e1d..0e4cc41 100644 --- a/test/logging.js +++ b/test/logging.js @@ -30,7 +30,7 @@ vows.describe('log4js').addBatch({ logger.trace("Trace event 2"); logger.warn("Warning event"); logger.error("Aargh!", new Error("Pants are on fire!")); - logger.error("Simulated CouchDB problem", JSON.stringify({ err: 127, cause: "incendiary underwear" })); + logger.error("Simulated CouchDB problem", { err: 127, cause: "incendiary underwear" }); return events; }, @@ -52,7 +52,7 @@ vows.describe('log4js').addBatch({ 'should convert things that claim to be errors into Error objects': function (events) { assert.instanceOf(events[3].exception, Error); - assert.equal(events[3].exception.message, '{"err":127,"cause":"incendiary underwear"}'); + assert.equal(events[3].exception.message, "{ err: 127, cause: 'incendiary underwear' }"); }, },