raven
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -9,4 +9,5 @@ module.exports = require('./lib/client'); | ||
module.exports.transports = require('./lib/transports'); | ||
module.exports.parsers = require('./lib/parsers'); | ||
// To infinity and beyond | ||
Error.stackTraceLimit = Infinity; |
@@ -28,3 +28,2 @@ var parsers = require('./parsers'); | ||
this.name = options.name || process.env.SENTRY_NAME || require('os').hostname(); | ||
this.site = options.site || process.env.SENTRY_SITE; | ||
this.root = options.root || process.cwd(); | ||
@@ -56,3 +55,6 @@ this.transport = options.transport || transports[this.dsn.protocol]; | ||
kwargs['extra'] = kwargs['extra'] || {}; | ||
kwargs['extra']['node'] = process.version; | ||
if (typeof process.version !== undefined) { | ||
kwargs['extra']['node'] = process.version; | ||
} | ||
kwargs['tags'] = kwargs['tags'] || {}; | ||
kwargs['logger'] = kwargs['logger'] || this.loggerName; | ||
@@ -62,3 +64,2 @@ kwargs['event_id'] = uuid().replace(/-/g, ''); | ||
kwargs['project'] = this.dsn.project_id; | ||
kwargs['site'] = kwargs['site'] || this.site; | ||
kwargs['platform'] = 'node'; | ||
@@ -121,6 +122,4 @@ | ||
// throw "something awesome"; | ||
// We just send the "Error" as a normal message | ||
// since there is no way to compute a stack trace | ||
// See: https://github.com/mattrobenolt/raven-node/issues/18 | ||
return this.captureMessage('Error: ' + err, kwargs, cb); | ||
// We synthesize an Error here so we can extract a (rough) stack trace. | ||
var err = new Error(err); | ||
} | ||
@@ -169,11 +168,27 @@ | ||
var called = false; | ||
process.on('uncaughtException', function(err) { | ||
if(cb) { // bind event listeners only if a callback was supplied | ||
client.once('logged', function() { | ||
var onLogged = function onLogged() { | ||
called = false; | ||
cb(true, err); | ||
}); | ||
client.once('error', function() { | ||
}; | ||
var onError = function onError() { | ||
called = false; | ||
cb(false, err); | ||
}); | ||
}; | ||
if(called) { | ||
client.removeListener('logged', onLogged); | ||
client.removeListener('error', onError); | ||
return cb(false, err); | ||
} | ||
client.once('logged', onLogged); | ||
client.once('error', onError); | ||
} | ||
called = true; | ||
client.captureError(err, function(result) { | ||
@@ -180,0 +195,0 @@ node_util.log('uncaughtException: '+client.getIdent(result)); |
@@ -40,3 +40,3 @@ var cookie = require('cookie'); | ||
if (frames[n].in_app) { | ||
kwargs.culprit = utils.getCulprit(frames[n]); | ||
kwargs.culprit = kwargs.culprit || utils.getCulprit(frames[n]); | ||
break; | ||
@@ -43,0 +43,0 @@ } |
@@ -155,3 +155,3 @@ var raven = require('./client'); | ||
parseLines(cache[frame.filename]); | ||
if (--callbcaks === 0) cb(frames); | ||
if (--callbacks === 0) cb(frames); | ||
return; | ||
@@ -158,0 +158,0 @@ } |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"repository": "git://github.com/getsentry/raven-node.git", | ||
@@ -15,0 +15,0 @@ "author": "Matt Robenolt <matt@ydekproductions.com>", |
@@ -14,3 +14,3 @@ # Raven [![Build Status](https://secure.travis-ci.org/getsentry/raven-node.png?branch=master)](http://travis-ci.org/getsentry/raven-node) | ||
Raven 0.6+ requires Sentry 6.0+ | ||
Raven 0.7+ requires Sentry 6.4+ | ||
@@ -40,3 +40,3 @@ ## Installation | ||
**There are 5 logging levels (in order):** | ||
**Sentry is aware of five different levels:** | ||
* debug (the least serious) | ||
@@ -51,8 +51,17 @@ * info | ||
var client = new raven.Client('{{ SENTRY_DSN }}', {level: 'warning'}); | ||
client.captureMessage("Another message") | ||
``` | ||
**Adding extra info an event** | ||
```javascript | ||
var raven = require('raven'); | ||
var client = new raven.Client('{{ SENTRY_DSN }}'); | ||
client.captureMessage("Another message", {level: 'info'}) | ||
client.captureMessage("Another message", {extra: {'key': 'value'}}) | ||
``` | ||
**Adding extra info to messages** | ||
**Adding tags to an event** | ||
```javascript | ||
@@ -63,3 +72,3 @@ var raven = require('raven'); | ||
client.captureMessage("Another message", {level: 'info', extra: {'key': 'value'}}) | ||
client.captureMessage("Another message", {tags: {'key': 'value'}}) | ||
``` | ||
@@ -176,8 +185,7 @@ | ||
var app = require('express')(); | ||
app.use(app.router); | ||
app.use(raven.middleware.express('{{ SENTRY_DSN }}')); | ||
app.use(onError); // optional error handler if you want to display the error id to a user | ||
app.get('/', function mainHandler(req, res) { | ||
throw new Error('Broke!'); | ||
}); | ||
app.use(raven.middleware.express('{{ SENTRY_DSN }}')); | ||
app.use(onError); // optional error handler if you want to display the error id to a user | ||
app.listen(3000); | ||
@@ -184,0 +192,0 @@ ``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
38213
19
656
232
6