Conversation
…ExtraErrorData` integration
|
Why is this in the |
| function _enhanceEventWithErrorData(event: Event, hint: EventHint = {}, depth: number): Event { | ||
| function _enhanceEventWithErrorData( | ||
| event: Event, | ||
| hint: EventHint = {}, |
There was a problem hiding this comment.
| hint: EventHint = {}, | |
| hint: EventHint | undefined = {}, |
There was a problem hiding this comment.
Optional values should be at the end of the arguments list. I thought we had a rule for this?
There was a problem hiding this comment.
The parameter is not optional. It just takes undefined and falls back to {}. Optional parameters are marked with a ? like this hint?: EventHint. Additionally, your suggestion doesn't do anything because TS already knows to allow undefined as type for parameters with default.
|
|
||
| // Error.cause is a standard property that is non enumerable, we therefore need to access it separately. | ||
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause | ||
| if (captureErrorCause && error['cause']) { |
There was a problem hiding this comment.
| if (captureErrorCause && error['cause']) { | |
| if (captureErrorCause && error.hasOwnProperty('cause')) { |
There was a problem hiding this comment.
We cannot do this because cause is a prototype (? or class field, or getter idk) and hasOwnProperty will return false even though it is there.
Based on patterns we have already established, likely no. |
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
…ExtraErrorData` integration (#9914) Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
Fixes #9913
We currently have no proper way of capturing error causes in the SDK when they're not errors but serializable objects. In theory the spec allows for this so we should support it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause#providing_structured_data_as_the_error_cause