Skip to content

Commit

Permalink
Update to v7 of API spec
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrobenolt committed Nov 2, 2015
1 parent 32965d9 commit a52ba5f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 54 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
},
Expand Down
110 changes: 62 additions & 48 deletions test/raven.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a52ba5f

Please sign in to comment.