Comparing version 1.12.1 to 1.12.2
Changelog | ||
========= | ||
## 1.12.2 (2017-09-13) | ||
### Bug fixes | ||
* Handle and report invalid `notify(err)` argument. Fixes | ||
[#110](https://github.com/bugsnag/bugsnag-node/issues/110). | ||
[#114](https://github.com/bugsnag/bugsnag-node/pull/114) | ||
## 1.12.1 (2017-09-01) | ||
@@ -5,0 +13,0 @@ |
@@ -119,2 +119,9 @@ "use strict"; | ||
} | ||
if ((!error && typeof error !== "string") || error === true) { | ||
Configuration.logger.error("Bugsnag.notify(error…) accepts an object or a string but was called with '" + error + "'"); | ||
options.metaData = { | ||
"notify() arguments": JSON.stringify([].map.call(arguments, function(arg) { return arg }), Utils.sensibleReplacer, 2) | ||
}; | ||
error = new Error("[Bugsnag] Bugsnag.notify(error…) accepts an object or a string but was called with '" + error + "'"); | ||
} | ||
if (!Bugsnag.shouldNotify()) { | ||
@@ -121,0 +128,0 @@ if (cb) { |
@@ -13,3 +13,3 @@ "use strict"; | ||
var NOTIFIER_NAME = "Bugsnag Node Notifier", | ||
NOTIFIER_VERSION = "1.12.1", | ||
NOTIFIER_VERSION = "1.12.2", | ||
NOTIFIER_URL = "https://github.com/bugsnag/bugsnag-node", | ||
@@ -16,0 +16,0 @@ SUPPORTED_SEVERITIES = ["error", "warning", "info"]; |
@@ -146,2 +146,12 @@ "use strict"; | ||
return '[FILTERED]'; | ||
}, | ||
// this custom replacer (for use in JSON.stringify(obj, replacer, spaces)) is implemented to | ||
// ensure values such as `undefined` and `Function` get serialized in a sensible way. Otherwise | ||
// `Function`s get removed and `undefined` gets converted to null, which would be misleading if | ||
// you are trying to accurately represent an actual JS object. | ||
sensibleReplacer: function (key, value) { | ||
if (value === undefined) return "undefined"; | ||
if (typeof value === "function") return value.name ? ("[function " + value.name + "()]") : "[anonymous function]"; | ||
return value; | ||
} | ||
@@ -148,0 +158,0 @@ }; |
{ | ||
"name": "bugsnag", | ||
"description": "Bugsnag notifier for node.js scripts", | ||
"version": "1.12.1", | ||
"version": "1.12.2", | ||
"main": "./lib/bugsnag.js", | ||
@@ -15,8 +15,10 @@ "typings": "./lib/bugsnag.d.ts", | ||
"devDependencies": { | ||
"mocha": "latest", | ||
"chai": "~1.5.0", | ||
"sinon": "latest", | ||
"coveralls": "^2.13.1", | ||
"express": "~3.4.2", | ||
"grunt": "~0.4.0", | ||
"grunt-bumpx": "latest", | ||
"express": "~3.4.2" | ||
"mocha": "latest", | ||
"nyc": "^11.2.1", | ||
"sinon": "latest" | ||
}, | ||
@@ -34,3 +36,4 @@ "repository": { | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "nyc --reporter=lcov --reporter=text mocha && (if [ -n \"$TRAVIS\" ]; then cat ./coverage/lcov.info | coveralls; fi)", | ||
"test:quick": "mocha" | ||
}, | ||
@@ -37,0 +40,0 @@ "engine": { |
@@ -370,2 +370,28 @@ "use strict"; | ||
}); | ||
describe("bad input", function() { | ||
it("notify(err) should handle bad input", function () { | ||
should.not.throw(function () { | ||
Bugsnag.notify(null); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify(undefined); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify(0); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify([]); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify(new Date()); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify(false); | ||
}); | ||
should.not.throw(function () { | ||
Bugsnag.notify(true); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -352,2 +352,8 @@ "use strict"; | ||
}); | ||
describe("sensibleReplacer", function () { | ||
JSON.stringify({ a: undefined }, Utils.sensibleReplacer).should.equal("{\"a\":\"undefined\"}"); | ||
JSON.stringify({ a: function a() {} }, Utils.sensibleReplacer).should.equal("{\"a\":\"[function a()]\"}"); | ||
JSON.stringify({ a: [ function () {} ] }, Utils.sensibleReplacer).should.equal("{\"a\":[\"[anonymous function]\"]}"); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
133096
36
1892
1
8