Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/core/src/domain/error/error.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,21 @@ describe('computeRawError', () => {
column: 15,
func: 'foo',
line: 52,
url: 'http://path/to/file.js',
url: 'http://path/to/file-1.js',
},
{
args: [],
column: undefined,
func: '?',
line: 12,
url: 'http://path/to/file.js',
url: 'http://path/to/file-2.js',
},
{
args: ['baz'],
column: undefined,
func: '?',
line: undefined,
url: 'http://path/to/file.js',
url: 'http://path/to/file-3.js',
},
],
}
Expand All @@ -128,10 +128,11 @@ describe('computeRawError', () => {

expect(formatted.message).toEqual('oh snap!')
expect(formatted.stack).toEqual(`TypeError: oh snap!
at foo(1, bar) @ http://path/to/file.js:52:15
at <anonymous> @ http://path/to/file.js:12
at <anonymous>(baz) @ http://path/to/file.js`)
at foo(1, bar) @ http://path/to/file-1.js:52:15
at <anonymous> @ http://path/to/file-2.js:12
at <anonymous>(baz) @ http://path/to/file-3.js`)
expect(formatted.type).toEqual('TypeError')
expect(formatted.file).toEqual('http://path/to/file-1.js')
})

it('should set handling according to given parameter', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/domain/error/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function computeErrorBase({
type: stackTrace ? stackTrace.name : undefined,
message: computeMessage(stackTrace, isErrorInstance, nonErrorPrefix, originalError),
stack: stackTrace ? toStackTraceString(stackTrace) : useFallbackStack ? NO_ERROR_STACK_PRESENT_MESSAGE : undefined,
file: stackTrace?.stack[0]?.url,
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/domain/error/error.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface RawError {
message: string
type?: string
stack?: string
file?: string
source: ErrorSource
originalError?: unknown
handling?: ErrorHandling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('createErrorFieldFromRawError', () => {
type: 'qux',
message: 'quux',
stack: 'quuz',
file: 'https://example.com/quux.js',
causes: [],
fingerprint: 'corge',
csp: {
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/src/domain/error/errorCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function processError(error: RawError): RawRumEventCollectedData<RawRumErrorEven
message: error.message,
source: error.source,
stack: error.stack,
file: error.file,
handling_stack: error.handlingStack,
component_stack: error.componentStack,
type: error.type,
Expand Down
1 change: 1 addition & 0 deletions packages/rum-core/src/rawRumEvent.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export interface RawRumErrorEvent {
id: string
type?: string
stack?: string
file?: string
handling_stack?: string
component_stack?: string
fingerprint?: string
Expand Down