Comparing version 0.6.3 to 0.7.0
@@ -0,8 +1,9 @@ | ||
var cookie = require('cookie'); | ||
var urlParser = require('url'); | ||
var utils = require('./utils'); | ||
var url = require('url'); | ||
var cookie = require('cookie'); | ||
module.exports.parseText = function parseText(message, kwargs) { | ||
kwargs = kwargs || {}; | ||
kwargs['message'] = message; | ||
kwargs.message = message; | ||
return kwargs; | ||
@@ -13,3 +14,3 @@ }; | ||
utils.parseStack(err, function(frames) { | ||
kwargs['message'] = err.name + ': ' + (err.message || '<no message>'); | ||
kwargs.message = err.name + ': ' + (err.message || '<no message>'); | ||
kwargs['sentry.interfaces.Exception'] = { | ||
@@ -21,5 +22,20 @@ type: err.name, | ||
// Save additional error properties to `extra` under the error type (e.g. `extra.AttributeError`) | ||
var extraErrorProps; | ||
for (var key in err) { | ||
if (err.hasOwnProperty(key)) { | ||
if (key !== 'name' && key !== 'message' && key !== 'stack') { | ||
extraErrorProps = extraErrorProps || {}; | ||
extraErrorProps[key] = err[key]; | ||
} | ||
} | ||
} | ||
if (extraErrorProps) { | ||
kwargs.extra = kwargs.extra || {}; | ||
kwargs.extra[err.name] = extraErrorProps; | ||
} | ||
for (var n = frames.length - 1; n >= 0; n--) { | ||
if (frames[n].in_app) { | ||
kwargs['culprit'] = utils.getCulprit(frames[n]); | ||
kwargs.culprit = utils.getCulprit(frames[n]); | ||
break; | ||
@@ -35,3 +51,3 @@ } | ||
kwargs = kwargs || {}; | ||
kwargs['message'] = query; | ||
kwargs.message = query; | ||
kwargs['sentry.interfaces.Query'] = { | ||
@@ -47,21 +63,95 @@ query: query, | ||
// create absolute url | ||
var host = req.headers.host || '<no host>'; | ||
var full_url = (req.socket.encrypted ? 'https' : 'http') + '://' + host + req.url; | ||
// headers: | ||
// | ||
// node: req.headers | ||
// express: req.headers | ||
// koa: req.header | ||
// | ||
var headers = req.headers || req.header || {}; | ||
// method: | ||
// | ||
// node: req.method | ||
// express: req.method | ||
// koa: req.method | ||
// | ||
var method = req.method; | ||
// host: | ||
// | ||
// node: req.headers.host | ||
// express: req.host | ||
// koa: req.host | ||
// | ||
var host = req.host || headers.host || '<no host>'; | ||
// protocol: | ||
// | ||
// node: <n/a> | ||
// express: req.protocol | ||
// koa: req.protocol | ||
// | ||
var protocol = ('https' === req.protocol || true === req.secure || true === (req.socket || {}).encrypted) ? 'https' : 'http'; | ||
// url (including path and query string): | ||
// | ||
// node: req.originalUrl | ||
// express: req.originalUrl | ||
// koa: req.url | ||
// | ||
var originalUrl = req.originalUrl || req.url; | ||
// absolute url | ||
var url = protocol + '://' + host + originalUrl; | ||
// query string | ||
// | ||
// node: req.url (raw) | ||
// express: req.query | ||
// koa: req.query | ||
// | ||
var query = req.query || urlParser.parse(originalUrl || '', true).query; | ||
// cookies: | ||
// | ||
// node: req.headers.cookie | ||
// express: req.headers.cookie | ||
// koa: req.headers.cookie | ||
// | ||
var cookies = cookie.parse(headers.cookie || ''); | ||
// body data: | ||
// | ||
// node: req.body | ||
// express: req.body | ||
// koa: req.body | ||
// | ||
var data = req.body || '<unavailable>'; | ||
// client ip: | ||
// | ||
// node: req.connection.remoteAddress | ||
// express: req.ip | ||
// koa: req.ip | ||
// | ||
var ip = req.ip || (req.connection || {}).remoteAddress; | ||
// http interface | ||
var http = { | ||
method: req.method, | ||
query_string: url.parse(req.url).query, | ||
headers: req.headers, | ||
cookies: req.cookies || cookie.parse(req.headers.cookies || ''), | ||
data: req.body || '<unavailable>', | ||
url: full_url, | ||
method: method, | ||
query_string: query, | ||
headers: headers, | ||
cookies: cookies, | ||
data: data, | ||
url: url, | ||
env: process.env | ||
}; | ||
var ip = (req.headers['x-forwarded-for'] || '').split(',')[0] || | ||
req.connection.remoteAddress; | ||
// add remote ip | ||
http.env.REMOTE_ADDR = ip; | ||
// expose http interface | ||
kwargs['sentry.interfaces.Http'] = http; | ||
return kwargs; | ||
}; |
@@ -15,3 +15,3 @@ var raven = require('./client'); | ||
module.exports.getAuthHeader = function getAuthHeader(timestamp, api_key, api_secret) { | ||
var header = ['Sentry sentry_version=4']; | ||
var header = ['Sentry sentry_version=5']; | ||
header.push('sentry_timestamp='+timestamp); | ||
@@ -18,0 +18,0 @@ header.push('sentry_client=raven-node/'+raven.version); |
{ | ||
"name": "raven", | ||
"description": "A standalone (Node.js) client for Sentry", | ||
"keywords": ["raven", "sentry", "python", "errors", "debugging", "exceptions"], | ||
"version": "0.6.3", | ||
"repository": "git://github.com/mattrobenolt/raven-node.git", | ||
"keywords": [ | ||
"raven", | ||
"sentry", | ||
"python", | ||
"errors", | ||
"debugging", | ||
"exceptions" | ||
], | ||
"version": "0.7.0", | ||
"repository": "git://github.com/getsentry/raven-node.git", | ||
"author": "Matt Robenolt <matt@ydekproductions.com>", | ||
@@ -20,17 +27,20 @@ "license": "BSD", | ||
"dependencies": { | ||
"cookie": "0.1.0", | ||
"lsmod": "~0.0.3", | ||
"node-uuid": "~1.4.1", | ||
"stack-trace": "0.0.7", | ||
"lsmod": "~0.0.3", | ||
"cookie": "0.1.0" | ||
"stack-trace": "0.0.7" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "~1.7.1", | ||
"glob": "~3.1.13", | ||
"mocha": "*", | ||
"mock-udp": "*", | ||
"nock": "~0.28.2", | ||
"should": "~3.3.1" | ||
}, | ||
"optionalDependencies": { | ||
"connect": "*", | ||
"express": "*", | ||
"mocha": "*", | ||
"should": "~2.0.1", | ||
"nock": "*", | ||
"glob": "*", | ||
"mock-udp": "*", | ||
"coffee-script": "~1.6.3" | ||
"koa": "*" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Raven [![Build Status](https://secure.travis-ci.org/mattrobenolt/raven-node.png?branch=master)](http://travis-ci.org/mattrobenolt/raven-node) | ||
# Raven [![Build Status](https://secure.travis-ci.org/getsentry/raven-node.png?branch=master)](http://travis-ci.org/getsentry/raven-node) | ||
**Node v0.11 compatible** | ||
@@ -3,0 +3,0 @@ |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
30359
6
592
7
16