-
-
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(utils): Truncate aggregate exception values (LinkedErrors)
- Loading branch information
Showing
6 changed files
with
144 additions
and
21 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...ges/browser-integration-tests/suites/public-api/captureException/linkedErrrors/subject.js
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,13 @@ | ||
const wat = new Error(`This is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be`); | ||
|
||
wat.cause = new Error(`This is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be,`); | ||
|
||
Sentry.captureException(wat); |
41 changes: 41 additions & 0 deletions
41
packages/browser-integration-tests/suites/public-api/captureException/linkedErrrors/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,41 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { Event } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers'; | ||
|
||
sentryTest('should capture a linked error with messages', async ({ getLocalTestPath, page }) => { | ||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url); | ||
|
||
expect(eventData.exception?.values).toHaveLength(2); | ||
expect(eventData.exception?.values?.[0]).toMatchObject({ | ||
type: 'Error', | ||
value: `This is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be, | ||
this is a very long message that should be truncated and hopefully will be, | ||
this is a very long me...`, | ||
mechanism: { | ||
type: 'chained', | ||
handled: true, | ||
}, | ||
stacktrace: { | ||
frames: expect.any(Array), | ||
}, | ||
}); | ||
expect(eventData.exception?.values?.[1]).toMatchObject({ | ||
type: 'Error', | ||
value: `This is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated and will be, | ||
this is a very long message that should be truncated...`, | ||
mechanism: { | ||
type: 'generic', | ||
handled: true, | ||
}, | ||
stacktrace: { | ||
frames: expect.any(Array), | ||
}, | ||
}); | ||
}); |
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
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
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
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