File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ module.exports = [
224224 import : createImport ( 'init' ) ,
225225 ignore : [ 'next/router' , 'next/constants' ] ,
226226 gzip : true ,
227- limit : '39.1 KB' ,
227+ limit : '40 KB' ,
228228 } ,
229229 // SvelteKit SDK (ESM)
230230 {
Original file line number Diff line number Diff line change @@ -37,8 +37,12 @@ export function resetInstrumentationHandlers(): void {
3737/** Maybe run an instrumentation function, unless it was already called. */
3838export function maybeInstrument ( type : InstrumentHandlerType , instrumentFn : ( ) => void ) : void {
3939 if ( ! instrumented [ type ] ) {
40- instrumentFn ( ) ;
4140 instrumented [ type ] = true ;
41+ try {
42+ instrumentFn ( ) ;
43+ } catch ( e ) {
44+ DEBUG_BUILD && logger . error ( `Error while instrumenting ${ type } ` , e ) ;
45+ }
4246 }
4347}
4448
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