feat(record): Allow callbackWrapper to attach a __source__ property to exceptions#111
Closed
feat(record): Allow callbackWrapper to attach a __source__ property to exceptions#111
callbackWrapper to attach a __source__ property to exceptions#111Conversation
…ty to exceptions Allow `callbackWrapper` to attach an optional `__source__` property to a caught exception. This will allow downstream errorHandlers to decide to re-throw an exception based on the source type.
billyvg
commented
Oct 12, 2023
Comment on lines
+33
to
+35
| if (errorSource) { | ||
| error.__source__ = errorSource; | ||
| } |
Member
Author
There was a problem hiding this comment.
Since this only happens if we have errorHandler defined, this probably only affects us. I opted to make this generic so that errorHandler be the source of truth vs attaching a meta property like __allowThrow__
billyvg
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 12, 2023
NOTE: This requires a bump to rrweb library Fixes an issue where the Replay integration can potentially break applications that use `styled-components`. `styled-components` [relies on an exception being throw](https://github.com/styled-components/styled-components/blob/b7b374bb1ceff1699f7035b15881bc807110199a/packages/styled-components/src/sheet/Tag.ts#L32-L40) for CSS rules that are not supported by the browser engine. However, our SDK suppresses any exceptions thrown from within rrweb, so `styled-components` assumes that an unsupported rule was inserted successfully and increases a rule index, which causes following inserted rules to fail due to an out-of-bounds error. getsentry/rrweb#111 introduces a change the adds metadata to exceptions that occur when calling `insertRule`, and this PR will re-throw those exceptions that will then bubble up to `styled-components`. Fixes #9170
Member
Author
|
Actually, we probably don't need this as we should just re-throw error in our Replay SDK. |
mydea
pushed a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 13, 2023
NOTE: This requires a bump to rrweb library Fixes an issue where the Replay integration can potentially break applications that use `styled-components`. `styled-components` [relies on an exception being throw](https://github.com/styled-components/styled-components/blob/b7b374bb1ceff1699f7035b15881bc807110199a/packages/styled-components/src/sheet/Tag.ts#L32-L40) for CSS rules that are not supported by the browser engine. However, our SDK suppresses any exceptions thrown from within rrweb, so `styled-components` assumes that an unsupported rule was inserted successfully and increases a rule index, which causes following inserted rules to fail due to an out-of-bounds error. getsentry/rrweb#111 introduces a change the adds metadata to exceptions that occur when calling `insertRule`, and this PR will re-throw those exceptions that will then bubble up to `styled-components`. Fixes #9170
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow
callbackWrapperto attach an optional__source__property to a caught exception. This will allow downstream errorHandlers to decide to re-throw an exception based on the source type.Needed to address getsentry/sentry-javascript#9170