Skip to content

Commit 9e36eea

Browse files
wong2HazAT
authored andcommitted
Serialize error object with message in ExtraErrorData integration (#1957)
* Serialize error object with message in ExtraErrorData integration * Update ExtraErrorData test * Update packages/core/src/integrations/extraerrordata.ts Co-Authored-By: wong2 <[email protected]> * We should just use Error.prototype.toString
1 parent f0085e9 commit 9e36eea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/core/src/integrations/extraerrordata.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class ExtraErrorData implements Integration {
9292
for (const key of errorKeys) {
9393
let value = error[key];
9494
if (isError(value)) {
95-
value = (value as Error).name || (value as Error).constructor.name;
95+
value = (value as Error).toString();
9696
}
9797
extraErrorInfo[key] = value;
9898
}

packages/core/test/lib/integrations/extraerrordata.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('ExtraErrorData()', () => {
4343

4444
expect(enhancedEvent.extra).toEqual({
4545
TypeError: {
46-
cause: 'SyntaxError',
46+
cause: 'SyntaxError: bar',
4747
},
4848
});
4949
});

0 commit comments

Comments
 (0)