Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bugsnag

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bugsnag - npm Package Compare versions

Comparing version 1.6.6 to 1.7.0

16

CHANGELOG.md
Changelog
=========
## 1.7.0 (2016-01-27)
### Bug Fixes
* Relax `request` and `promise` dependency requirements to allow patched updates
[Jakub Pawlowicz](https://github.com/jakubpawlowicz)
[#70](https://github.com/bugsnag/bugsnag-node/pull/70)
[#71](https://github.com/bugsnag/bugsnag-node/issues/71)
### Enhancements
* Added support for sending code snippets
[Jacob Marshall](https://github.com/jacobmarshall)
[#65](https://github.com/bugsnag/bugsnag-node/issues/65)
[#67](https://github.com/bugsnag/bugsnag-node/pull/67)
1.6.6

@@ -5,0 +21,0 @@ -----

8

lib/bugsnag.js

@@ -102,3 +102,9 @@ var domain = require("domain"),

notification = new Notification(bugsnagErrors, options);
notification.deliver(cb);
if (Configuration.sendCode === true) {
notification.loadCode(function () {
notification.deliver(cb);
});
} else {
notification.deliver(cb);
}
};

@@ -105,0 +111,0 @@

@@ -24,2 +24,3 @@ var path = require("path"),

logger: new Logger(),
sendCode: false,

@@ -69,2 +70,3 @@ beforeNotifyCallbacks: [],

}
Configuration.sendCode = options.sendCode || Configuration.sendCode;
}

@@ -71,0 +73,0 @@ }

var stacktrace = require("stack-trace"),
fs = require('fs'),
Promise = require('promise'),
Utils = require("./utils"),
Configuration = require("./configuration");
function loadCode (error, callback) {
var padding = 4; // Padding of either side of the frame's line (4 actually means 3...)
Promise.all(error.stacktrace.map(function (frame) {
if (frame.inProject) {
return new Promise(function (resolve) {
fs.readFile(frame.path, function (err, data) {
if ( ! err) {
var fileLines = data.toString().split('\n');
frame.code = {};
for (var i = frame.lineNumber - padding; i < (frame.lineNumber - 1) + padding; i++) {
if (typeof fileLines[i] === 'string') {
frame.code[i + 1] = fileLines[i];
}
}
}
resolve();
});
});
}
})).then(callback);
}
function processCallSites (callSites) {

@@ -10,2 +38,3 @@ return callSites.map(function(callSite) {

file: callSite.getFileName(),
path: callSite.getFileName(),
method: callSite.getMethodName() || callSite.getFunctionName() || "none",

@@ -46,2 +75,6 @@ lineNumber: callSite.getLineNumber(),

Error.prototype.loadCode = function (callback) {
loadCode(this, callback);
};
Error.buildErrors = function(error, errorClass) {

@@ -48,0 +81,0 @@ var returnArray;

var Utils = require("./utils"),
var Promise = require('promise'),
Utils = require("./utils"),
Logger = require("./logger"),

@@ -202,3 +203,13 @@ Configuration = require("./configuration"),

Notification.prototype.loadCode = function (callback) {
return Promise.all(this.events.map(function (event) {
return Promise.all(event.exceptions.map(function (error) {
return new Promise(function (resolve) {
error.loadCode(resolve);
});
}));
})).then(callback);
};
module.exports = Notification;

5

package.json
{
"name": "bugsnag",
"description": "Bugsnag notifier for node.js scripts",
"version": "1.6.6",
"version": "1.7.0",
"main": "./lib/bugsnag.js",
"homepage": "http://bugsnag.com",
"dependencies": {
"promise": "7.x",
"stack-trace": "0.0.9",
"request": "2.53.0"
"request": "2.x"
},

@@ -11,0 +12,0 @@ "devDependencies": {

@@ -320,2 +320,15 @@ Bugsnag Notifier for Node.js

### sendCode
If you want to send code snippets for each frame of the stacktrace you can enable `sendCode`. This asynchronously loads
any file from the stacktrace, which is within the scope of the project, and sends 3 lines either side of the erroneous line
of code to Bugsnag.
This works almost the same as how Bugsnag JavaScript projects handle sourcemaps - however loading the code is done on the
local machine and sent over the internet with the error data.
```javascript
bugsnag.register("your-api-key-here", { sendCode: true });
```
Notify

@@ -322,0 +335,0 @@ ------

@@ -176,3 +176,3 @@ // Generated by CoffeeScript 1.8.0

deliverStub.firstCall.thisValue.events[0].exceptions[0].stacktrace.should.have.length.of.at.least(2);
deliverStub.firstCall.thisValue.events[0].exceptions[0].stacktrace[0].should.have.keys("file", "lineNumber", "columnNumber", "method");
deliverStub.firstCall.thisValue.events[0].exceptions[0].stacktrace[0].should.have.keys("file", "lineNumber", "columnNumber", "method", "path");
deliverStub.firstCall.thisValue.events[0].exceptions[0].stacktrace[0].file.should.contain(path.sep + "error.js");

@@ -179,0 +179,0 @@ deliverStub.firstCall.thisValue.events[0].exceptions[0].stacktrace[0].lineNumber.should.be.an("number");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc