File tree 3 files changed +19
-2
lines changed
3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ module.exports = [
224
224
import : createImport ( 'init' ) ,
225
225
ignore : [ 'next/router' , 'next/constants' ] ,
226
226
gzip : true ,
227
- limit : '39.1 KB' ,
227
+ limit : '40 KB' ,
228
228
} ,
229
229
// SvelteKit SDK (ESM)
230
230
{
Original file line number Diff line number Diff line change @@ -37,8 +37,12 @@ export function resetInstrumentationHandlers(): void {
37
37
/** Maybe run an instrumentation function, unless it was already called. */
38
38
export function maybeInstrument ( type : InstrumentHandlerType , instrumentFn : ( ) => void ) : void {
39
39
if ( ! instrumented [ type ] ) {
40
- instrumentFn ( ) ;
41
40
instrumented [ type ] = true ;
41
+ try {
42
+ instrumentFn ( ) ;
43
+ } catch ( e ) {
44
+ DEBUG_BUILD && logger . error ( `Error while instrumenting ${ type } ` , e ) ;
45
+ }
42
46
}
43
47
}
44
48
Original file line number Diff line number Diff line change
1
+ import { maybeInstrument } from '../src' ;
2
+
3
+ describe ( 'maybeInstrument' , ( ) => {
4
+ test ( 'does not throw when instrumenting fails' , ( ) => {
5
+ maybeInstrument ( 'xhr' , ( ) => {
6
+ throw new Error ( 'test' ) ;
7
+ } ) ;
8
+ } ) ;
9
+
10
+ test ( 'does not throw when instrumenting fn is not a function' , ( ) => {
11
+ maybeInstrument ( 'xhr' , undefined as any ) ;
12
+ } ) ;
13
+ } ) ;
You can’t perform that action at this time.
0 commit comments