Skip to content

Commit 58737b4

Browse files
authored
added ids to exception objects (#475)
1 parent c74bc4a commit 58737b4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/core/lib/segments/attributes/captured_exception.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const crypto = require('crypto');
2+
13
/**
24
* Represents a captured exception.
35
* @constructor
@@ -16,6 +18,7 @@ CapturedException.prototype.init = function init(err, remote) {
1618
this.type = e.name;
1719
this.stack = [];
1820
this.remote = !!remote;
21+
this.id = crypto.randomBytes(8).toString('hex');
1922

2023
if (e.stack) {
2124
var stack = e.stack.split('\n');

packages/core/test/unit/segments/attributes/captured_exception.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('CapturedException', function() {
99

1010
assert.equal(captured.message, err);
1111
assert.equal(captured.type, '');
12+
assert.equal(captured.id.length, 16);
1213
assert.deepEqual(captured.stack, []);
1314
});
1415

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

1920
assert.equal(captured.message, err.message);
2021
assert.equal(captured.type, err.name);
22+
assert.equal(captured.id.length, 16);
2123
assert.isArray(captured.stack);
2224
});
2325

0 commit comments

Comments
 (0)