Socket
Socket
Sign inDemoInstall

raven

Package Overview
Dependencies
4
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1

example/error.js

31

lib/client.js

@@ -9,4 +9,2 @@ var parsers = require('./parsers');

var events = require('events');
var raw = require('raw-stacktrace');
var traces = null;

@@ -28,15 +26,2 @@ module.exports.version = require('../package.json').version;

var tracesOpts = { rawCallSites : true };
if ('function' == typeof options.stackFunction)
tracesOpts.formatter = options.stackFunction;
// Ensures traces is only defined once
if (!traces) {
traces = traces || raw(tracesOpts);
traces.setMaxListeners(100);
traces.on("trace", function(err, callsites) {
err.structuredStackTrace = callsites;
});
}
this.raw_dsn = dsn;

@@ -64,9 +49,6 @@ this.dsn = utils.parseDSN(dsn);

_.get_ident = function getIdent(result) {
return result.id+'$'+result.checksum;
return result.id;
};
_.process = function process(kwargs) {
var event_id = uuid().replace(/-/g, ''),
checksum;
kwargs['modules'] = utils.getModules();

@@ -77,10 +59,3 @@ kwargs['server_name'] = kwargs['server_name'] || this.name;

kwargs['logger'] = this.loggerName;
if(!kwargs['checksum']){
checksum = kwargs['checksum'] = utils.constructChecksum(kwargs);
} else {
checksum = kwargs['checksum'];
}
kwargs['event_id'] = event_id;
kwargs['event_id'] = uuid().replace(/-/g, '');
kwargs['timestamp'] = new Date().toISOString().split('.')[0];

@@ -94,3 +69,3 @@ kwargs['project'] = this.dsn.project_id;

return {'id': event_id, 'checksum': checksum};
return {'id': kwargs['event_id']};
};

@@ -97,0 +72,0 @@

var utils = require('./utils');
var url = require('url');
var cookie = require('cookie');

@@ -11,4 +12,3 @@ module.exports.parseText = function parseText(message, kwargs) {

module.exports.parseError = function parseError(err, kwargs, cb) {
err.stack; // Error.prepareStackTrace is only called when stack is accessed, so access it
utils.parseStack(err.structuredStackTrace, function(frames) {
utils.parseStack(err, function(frames) {
kwargs['message'] = err.name + ': ' + (err.message || '<no message>');

@@ -21,3 +21,3 @@ kwargs['sentry.interfaces.Exception'] = {

for (var n = 0, l = frames.length; n < l; n++) {
for (var n = frames.length - 1; n >= 0; n--) {
if (frames[n].in_app) {

@@ -45,2 +45,7 @@ kwargs['culprit'] = utils.getCulprit(frames[n]);

kwargs = kwargs || {};
// create absolute url
var host = req.headers.host || '<no host>';
var full_url = (req.socket.encrypted ? 'https' : 'http') + '://' + host + req.url;
var http = {

@@ -50,9 +55,5 @@ method: req.method,

headers: req.headers,
cookies: req.cookies || '<unavailable: use cookieParser middleware>',
data: req.body || '<unavailable: use bodyParser middleware>',
url: (function build_absolute_url() {
var protocol = req.socket.encrypted ? 'https' : 'http',
host = req.headers.host || '<no host>';
return protocol+'://'+host+req.url;
}()),
cookies: req.cookies || cookie.parse(req.headers.cookies || ''),
data: req.body || '<unavailable>',
url: full_url,
env: process.env

@@ -59,0 +60,0 @@ };

@@ -15,13 +15,12 @@ var events = require('events');

HTTPTransport.prototype.send = function(client, message, headers) {
var self = client;
var options = {
hostname: self.dsn.host,
path: self.dsn.path + 'api/store/',
hostname: client.dsn.host,
path: client.dsn.path + 'api/store/',
headers: headers,
method: 'POST',
port: self.dsn.port || this.defaultPort
port: client.dsn.port || this.defaultPort
}, req = this.transport.request(options, function(res){
res.setEncoding('utf8');
if(res.statusCode >= 200 && res.statusCode < 300) {
self.emit('logged');
client.emit('logged');
} else {

@@ -33,3 +32,3 @@ var reason = res.headers['x-sentry-error'];

e.reason = reason;
self.emit('error', e);
client.emit('error', e);
}

@@ -42,3 +41,3 @@ // force the socket to drain

req.on('error', function(e){
self.emit('error', e);
client.emit('error', e);
});

@@ -61,11 +60,10 @@ req.end(message);

UDPTransport.prototype.send = function(client, message, headers) {
var self = client;
message = new Buffer(headers['X-Sentry-Auth'] + '\n\n'+ message);
var udp = dgram.createSocket('udp4');
udp.send(message, 0, message.length, self.dsn.port || this.defaultPort, self.dsn.host, function(e, bytes) {
udp.send(message, 0, message.length, client.dsn.port || this.defaultPort, client.dsn.host, function(e, bytes) {
if(e){
return self.emit('error', e);
return client.emit('error', e);
}
self.emit('logged');
client.emit('logged');
udp.close();

@@ -72,0 +70,0 @@ });

var raven = require('./client');
var crypto = require('crypto');
var fs = require('fs');

@@ -7,2 +6,4 @@ var url = require('url');

var path = require('path');
var lsmod = require('lsmod');
var stacktrace = require('stack-trace');

@@ -14,8 +15,2 @@ var protocolMap = {

module.exports.constructChecksum = function constructChecksum(kwargs) {
var checksum = crypto.createHash('md5');
checksum.update(kwargs['message'] || '');
return checksum.digest('hex');
};
module.exports.getAuthHeader = function getAuthHeader(timestamp, api_key, api_secret) {

@@ -70,27 +65,7 @@ var header = ['Sentry sentry_version=4'];

module.exports.getModules = function getModules() {
if(module_cache) {
if (module_cache) {
return module_cache;
}
module_cache = {};
require.main.paths.forEach(function(path_dir) {
if (!(fs.existsSync || path.existsSync)(path_dir)) {
return;
}
var modules = fs.readdirSync(path_dir).filter(function(name) {
return name.charAt(0) !== '.';
});
modules.forEach(function(module) {
var pkg_json = path.join(path_dir, module, 'package.json');
try {
var json = require(pkg_json);
module_cache[json.name] = json.version;
} catch(e) {}
});
});
return module_cache;
return module_cache = lsmod();
};

@@ -138,7 +113,12 @@

function parseStack(stack, cb) {
function parseStack(err, cb) {
var frames = [],
cache = {},
callbacks;
cache = {}
if (!err) {
return cb(frames);
}
var stack = stacktrace.parse(err);
// check to make sure that the stack is what we need it to be.

@@ -150,4 +130,7 @@ if (!stack || !Array.isArray(stack) || !stack.length || !stack[0].getFileName) {

callbacks = stack.length;
var callbacks = stack.length;
// Sentry requires the stack trace to be from oldest to newest
stack.reverse();
stack.forEach(function(line, index) {

@@ -196,16 +179,2 @@ var frame = {

}
// console.log(line.getThis());
// console.log(line.getTypeName());
// console.log(line.getFunction().caller);
// console.log(line.getFunction()+'');
// console.log(line.getFunctionName());
// console.log(line.getMethodName());
// console.log(line.getFileName());
// console.log(line.getLineNumber());
// console.log(line.getColumnNumber());
// console.log(line.getEvalOrigin());
// console.log(line.isToplevel());
// console.log(line.isNative());
// console.log(line.isConstructor());
});

@@ -212,0 +181,0 @@ }

{
"name": "raven",
"description": "A standalone (Node.js) client for Sentry",
"keywords": ["raven", "sentry", "python"],
"version": "0.6.0",
"keywords": ["raven", "sentry", "python", "errors", "debugging", "exceptions"],
"version": "0.6.1",
"repository": "git://github.com/mattrobenolt/raven-node.git",

@@ -11,3 +11,3 @@ "author": "Matt Robenolt <matt@ydekproductions.com>",

"scripts": {
"test": "NODE_ENV=test mocha --reporter dot"
"test": "NODE_ENV=test mocha --reporter dot && NODE_ENV=test coffee ./test/run.coffee"
},

@@ -18,4 +18,6 @@ "engines": {

"dependencies": {
"node-uuid": "1.4.0",
"raw-stacktrace": "1.0.0"
"node-uuid": "~1.4.1",
"stack-trace": "0.0.7",
"lsmod": "0.0.2",
"cookie": "0.1.0"
},

@@ -29,4 +31,5 @@ "devDependencies": {

"glob": "*",
"mock-udp": "*"
"mock-udp": "*",
"coffee-script": "~1.6.3"
}
}
# Raven [![Build Status](https://secure.travis-ci.org/mattrobenolt/raven-node.png?branch=master)](http://travis-ci.org/mattrobenolt/raven-node)
**Node v0.10 compatible**
**Node v0.11 compatible**

@@ -12,2 +12,3 @@ Log errors and stack traces in [Sentry](http://getsentry.com/) from within your Node.js applications. Includes middleware support for [Connect](http://www.senchalabs.org/connect/)/[Express](http://expressjs.com/).

* 0.10.x
* 0.11.x

@@ -14,0 +15,0 @@ Raven 0.6+ requires Sentry 6.0+

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc