Skip to content

Commit

Permalink
🐛[npm e2e] avoid console error issue
Browse files Browse the repository at this point in the history
when app is compiled with webpack, logs and rum use the same core lib which provoked a max call stack size issue on console.error usage
  • Loading branch information
bcaudan committed Feb 4, 2020
1 parent d8baa2a commit cf49b08
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/core/src/errorCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ export enum ErrorOrigin {
}

export type ErrorObservable = Observable<ErrorMessage>
let filteredErrorsObservable: Observable<ErrorMessage>

export function startErrorCollection(configuration: Configuration) {
const errorObservable = new Observable<ErrorMessage>()
if (configuration.isCollectingError) {
const requestObservable = startRequestCollection()
trackNetworkError(configuration, errorObservable, requestObservable)
startConsoleTracking(errorObservable)
startRuntimeErrorTracking(errorObservable)
if (!filteredErrorsObservable) {
const errorObservable = new Observable<ErrorMessage>()
if (configuration.isCollectingError) {
const requestObservable = startRequestCollection()
trackNetworkError(configuration, errorObservable, requestObservable)
startConsoleTracking(errorObservable)
startRuntimeErrorTracking(errorObservable)
}
filteredErrorsObservable = filterErrors(configuration, errorObservable)
}
return filterErrors(configuration, errorObservable)
return filteredErrorsObservable
}

export function filterErrors(configuration: Configuration, errorObservable: Observable<ErrorMessage>) {
Expand Down

0 comments on commit cf49b08

Please sign in to comment.