-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Mark stack trace from
captureMessage
with `attatchStackT…
…race: true` as synthetic (#14670) Analogously to #14668 for browser, this patch marks synthetic exceptions captured during a `captureException()` call as synthetic.
- Loading branch information
Showing
4 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...ration-tests/suites/public-api/captureMessage/simple_message_attachStackTrace/scenario.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { loggingTransport } from '@sentry-internal/node-integration-tests'; | ||
import * as Sentry from '@sentry/node'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
transport: loggingTransport, | ||
attachStacktrace: true, | ||
}); | ||
|
||
Sentry.captureMessage('Message'); |
25 changes: 25 additions & 0 deletions
25
...ntegration-tests/suites/public-api/captureMessage/simple_message_attachStackTrace/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { cleanupChildProcesses, createRunner } from '../../../../utils/runner'; | ||
|
||
afterAll(() => { | ||
cleanupChildProcesses(); | ||
}); | ||
|
||
test('capture a simple message string with a stack trace if `attachStackTrace` is `true`', done => { | ||
createRunner(__dirname, 'scenario.ts') | ||
.expect({ | ||
event: { | ||
message: 'Message', | ||
level: 'info', | ||
exception: { | ||
values: [ | ||
{ | ||
mechanism: { synthetic: true, type: 'generic', handled: true }, | ||
value: 'Message', | ||
stacktrace: { frames: expect.any(Array) }, | ||
}, | ||
], | ||
}, | ||
}, | ||
}) | ||
.start(done); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,7 @@ export function eventFromMessage( | |
}, | ||
], | ||
}; | ||
addExceptionMechanism(event, { synthetic: true }); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters