Comparing version 0.3.9 to 0.3.10
var fs = require('fs'); | ||
var lru = require('lru-cache'); | ||
var util = require('util'); | ||
@@ -25,3 +26,3 @@ var linesOfContext = 3; | ||
if (multipleErrs) { | ||
if (multipleErrs && multipleErrs.length) { | ||
var firstErr = multipleErrs[0]; | ||
@@ -32,3 +33,3 @@ ret = { | ||
frames: stack | ||
} | ||
}; | ||
} | ||
@@ -157,10 +158,13 @@ | ||
var getMultipleErrors = function(errors) { | ||
if (typeof errors === "undefined") | ||
if (errors == null || errors == undefined) { | ||
return null; | ||
} | ||
if (typeof errors !== "object") | ||
if (typeof errors !== "object") { | ||
return null; | ||
} | ||
if (errors instanceof Array) | ||
if (util.isArray(errors)) { | ||
return errors; | ||
} | ||
@@ -167,0 +171,0 @@ var errArray = []; |
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"repository": "git://github.com/rollbar/node_rollbar.git", | ||
@@ -16,0 +16,0 @@ "author": "Rollbar, Inc. <support@rollbar.com>", |
@@ -79,2 +79,48 @@ var assert = require('assert'); | ||
} | ||
}, | ||
'Multiple errors': { | ||
'Simple': { | ||
topic: function(err) { | ||
var exc1 = new Error('First error'); | ||
var exc2 = new Error('Second error'); | ||
var containerExc = new Error(); | ||
containerExc.errors = [exc1, exc2]; | ||
return parser.parseException(containerExc, this.callback); | ||
}, | ||
'it uses the first error': function(err, parsedObj) { | ||
assert.equal(parsedObj.message, 'First error'); | ||
} | ||
}, | ||
'exception.errors is an object': { | ||
topic: function(err) { | ||
var exc1 = new Error('First error'); | ||
var exc2 = new Error('Second error'); | ||
var containerExc = new Error(); | ||
containerExc.errors = {first: exc1, second: exc2}; | ||
return parser.parseException(containerExc, this.callback); | ||
}, | ||
'one of the errors was used': function(err, parsedObj) { | ||
assert.isTrue(parsedObj.message === 'First error' || parsedObj.message === 'Second error'); | ||
} | ||
}, | ||
'exception.errors is null': { | ||
topic: function(err) { | ||
var containerExc = new Error('Container error'); | ||
containerExc.errors = null; | ||
return parser.parseException(containerExc, this.callback); | ||
}, | ||
'the container error was used': function(err, parsedObj) { | ||
assert.equal(parsedObj.message, 'Container error'); | ||
} | ||
}, | ||
'exception.errors is an empty array': { | ||
topic: function(err) { | ||
var containerExc = new Error('Container error'); | ||
containerExc.errors = []; | ||
return parser.parseException(containerExc, this.callback); | ||
}, | ||
'the container error was used': function(err, parsedObj) { | ||
assert.equal(parsedObj.message, 'Container error'); | ||
} | ||
} | ||
} | ||
@@ -81,0 +127,0 @@ }).export(module, {error: false}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1201
54778
22