-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [RUMF-1353] Add Error.cause property #1740
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
10d8251
[RUMF-1353] Add Error.cause property
99d7246
remove ts-ignore comments in favour of as TS chaining
f0e2da8
use ? instead of undefined in type def
2a6bcfb
mimic formatUnknownError logic in flattenErrorCauses regarding cause …
1be956a
fix missing export
5262202
Merge branch 'main' into william/error-cause-property
liywjl c659327
stack should use type string
b2f1340
Update packages/core/src/tools/error.spec.ts
liywjl 20776e7
deprecate formatUnknownError in favour of computeRawError
10a72fc
revert rum-events-format update
6642d84
add test for flattenErrorCauses with stack
6a868a1
pass handling as prop
0f13557
use DEFAULT_RAW_ERROR_PARMS in error spec
d723a80
causes can be undefinded in errorCollection spec
6931d26
use originalError name and simplify flattenErrorCauses
7e7c4c5
update test name
d66c278
simplify test logic
4e500b7
Update packages/core/src/tools/error.ts
liywjl bf6bcdd
fix unit test
a332178
add test to check stacktrace comes from cause Error
1e55af3
update test naming
6d72cf5
update test name and object casting
de566e7
define error inline in test
0603c01
merge tests to reduce number of tests
9c6fd18
🐛 fix wrong stack trace being used in cause errors
ee8585a
check the cause type is the Error type name
3536ec1
Merge branch 'main' into william/error-cause-property
liywjl b8c98fc
Merge branch 'main' into william/error-cause-property
liywjl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import type { RawError } from '../../tools/error' | ||
import { ErrorSource, ErrorHandling, formatUnknownError } from '../../tools/error' | ||
import { ErrorSource, computeRawError, ErrorHandling } from '../../tools/error' | ||
import type { Observable } from '../../tools/observable' | ||
import { clocksNow } from '../../tools/timeUtils' | ||
import { startUnhandledErrorCollection } from '../tracekit' | ||
|
||
export function trackRuntimeError(errorObservable: Observable<RawError>) { | ||
return startUnhandledErrorCollection((stackTrace, errorObject) => { | ||
const { stack, message, type } = formatUnknownError(stackTrace, errorObject, 'Uncaught') | ||
errorObservable.notify({ | ||
message, | ||
stack, | ||
type, | ||
source: ErrorSource.SOURCE, | ||
startClocks: clocksNow(), | ||
originalError: errorObject, | ||
handling: ErrorHandling.UNHANDLED, | ||
}) | ||
return startUnhandledErrorCollection((stackTrace, originalError) => { | ||
errorObservable.notify( | ||
computeRawError({ | ||
stackTrace, | ||
originalError, | ||
startClocks: clocksNow(), | ||
nonErrorPrefix: 'Uncaught', | ||
source: ErrorSource.SOURCE, | ||
handling: ErrorHandling.UNHANDLED, | ||
}) | ||
) | ||
}) | ||
} |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!