Skip to content

Commit

Permalink
added ids to exception objects (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
willarmiros authored Nov 23, 2021
1 parent c74bc4a commit 58737b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/lib/segments/attributes/captured_exception.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const crypto = require('crypto');

/**
* Represents a captured exception.
* @constructor
Expand All @@ -16,6 +18,7 @@ CapturedException.prototype.init = function init(err, remote) {
this.type = e.name;
this.stack = [];
this.remote = !!remote;
this.id = crypto.randomBytes(8).toString('hex');

if (e.stack) {
var stack = e.stack.split('\n');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('CapturedException', function() {

assert.equal(captured.message, err);
assert.equal(captured.type, '');
assert.equal(captured.id.length, 16);
assert.deepEqual(captured.stack, []);
});

Expand All @@ -18,6 +19,7 @@ describe('CapturedException', function() {

assert.equal(captured.message, err.message);
assert.equal(captured.type, err.name);
assert.equal(captured.id.length, 16);
assert.isArray(captured.stack);
});

Expand Down

0 comments on commit 58737b4

Please sign in to comment.