Skip to content

Update to v7 of API spec #403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

Raven.js is a tiny standalone JavaScript client for [Sentry](https://www.getsentry.com/).

**Raven.js v1.1 requires Sentry v6.0 or later.**
**Raven.js v1.3 requires Sentry v7.7.0 or later.**

## Resources

5 changes: 3 additions & 2 deletions plugins/react-native.js
Original file line number Diff line number Diff line change
@@ -64,8 +64,9 @@ module.exports = function (Raven) {
data.culprit = normalizeUrl(data.culprit);
}

if (data.stacktrace && data.stacktrace.frames && data.stacktrace.frames.length) {
data.stacktrace.frames.forEach(function (frame) {
if (data.exception) {
// if data.exception exists, all of the other keys are guaranteed to exist
data.exception.values[0].stacktrace.frames.forEach(function (frame) {
frame.filename = normalizeUrl(frame.filename);
});
}
11 changes: 6 additions & 5 deletions src/raven.js
Original file line number Diff line number Diff line change
@@ -697,11 +697,12 @@ function processException(type, message, fileurl, lineno, frames, options) {
objectMerge({
// sentry.interfaces.Exception
exception: {
type: type,
value: message
values: [{
type: type,
value: message,
stacktrace: stacktrace
}]
},
// sentry.interfaces.Stacktrace
stacktrace: stacktrace,
culprit: fileurl,
message: fullMessage
}, options)
@@ -805,7 +806,7 @@ function send(data) {
(globalOptions.transport || makeRequest)({
url: globalServer,
auth: {
sentry_version: '4',
sentry_version: '7',
sentry_client: 'raven-js/' + Raven.VERSION,
sentry_key: globalKey
},
110 changes: 62 additions & 48 deletions test/raven.test.js
Original file line number Diff line number Diff line change
@@ -769,11 +769,13 @@ describe('globals', function() {
processException('Error', 'lol', 'http://example.com/override.js', 10, frames.slice(0), {});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: framesFlipped
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: framesFlipped
}
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol'
@@ -782,11 +784,13 @@ describe('globals', function() {
processException('Error', 'lol', '', 10, frames.slice(0), {});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: framesFlipped
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: framesFlipped
}
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol'
@@ -795,11 +799,13 @@ describe('globals', function() {
processException('Error', 'lol', '', 10, frames.slice(0), {extra: 'awesome'});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: framesFlipped
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: framesFlipped
}
}]
},
culprit: 'http://example.com/file1.js',
message: 'Error: lol',
@@ -813,14 +819,16 @@ describe('globals', function() {
processException('Error', 'lol', 'http://example.com/override.js', 10, [], {});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
}]
}
}]
},
culprit: 'http://example.com/override.js',
@@ -830,14 +838,16 @@ describe('globals', function() {
processException('Error', 'lol', 'http://example.com/override.js', 10, [], {});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
}]
}
}]
},
culprit: 'http://example.com/override.js',
@@ -847,14 +857,16 @@ describe('globals', function() {
processException('Error', 'lol', 'http://example.com/override.js', 10, [], {extra: 'awesome'});
assert.deepEqual(window.send.lastCall.args, [{
exception: {
type: 'Error',
value: 'lol'
},
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
values: [{
type: 'Error',
value: 'lol',
stacktrace: {
frames: [{
filename: 'http://example.com/override.js',
lineno: 10,
in_app: true
}]
}
}]
},
culprit: 'http://example.com/override.js',
@@ -879,14 +891,16 @@ describe('globals', function() {
assert.deepEqual(window.send.lastCall.args, [{
message: 'TypeError: ' + new Array(140).join('a')+'\u2026',
exception: {
type: 'TypeError',
value: new Array(151).join('a')+'\u2026'
},
stacktrace: {
frames: [{
filename: 'http://example.com',
lineno: 34,
in_app: true
values: [{
type: 'TypeError',
value: new Array(151).join('a')+'\u2026',
stacktrace: {
frames: [{
filename: 'http://example.com',
lineno: 34,
in_app: true
}]
}
}]
},
culprit: 'http://example.com',
@@ -1192,7 +1206,7 @@ describe('globals', function() {
assert.deepEqual(opts.auth, {
sentry_client: 'raven-js/<%= pkg.version %>',
sentry_key: 'abc',
sentry_version: '4'
sentry_version: '7'
});
assert.deepEqual(opts.options, globalOptions);
assert.isFunction(opts.onSuccess);