File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
packages/cloudflare/src/integrations Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export function getHonoIntegration(): ReturnType<typeof _honoIntegration> | unde
2222 if ( ! client ) {
2323 return undefined ;
2424 } else {
25- return client . getIntegrationByName ( INTEGRATION_NAME ) as ReturnType < typeof _honoIntegration > | undefined ;
25+ return client . getIntegrationByName ( INTEGRATION_NAME ) ;
2626 }
2727}
2828
@@ -33,21 +33,19 @@ function isHonoError(err: unknown): err is HonoError {
3333 return typeof err === 'object' && err !== null && 'status' in ( err as Record < string , unknown > ) ;
3434}
3535
36- // outside of integration to prevent resetting the variable
37- let _shouldHandleError : ( error : Error ) => boolean ;
38-
3936const _honoIntegration = ( ( options : Partial < Options > = { } ) => {
4037 return {
4138 name : INTEGRATION_NAME ,
42- setupOnce ( ) {
43- _shouldHandleError = options . shouldHandleError || defaultShouldHandleError ;
44- } ,
39+ setupOnce ( ) { } ,
4540 handleHonoException ( err : HonoError ) : void {
41+ const shouldHandleError = options . shouldHandleError || defaultShouldHandleError ;
42+
4643 if ( ! isHonoError ( err ) ) {
4744 DEBUG_BUILD && debug . log ( "[Hono] Won't capture exception in `onError` because it's not a Hono error." , err ) ;
4845 return ;
4946 }
50- if ( _shouldHandleError ( err ) ) {
47+
48+ if ( shouldHandleError ( err ) ) {
5149 captureException ( err , { mechanism : { handled : false , type : 'auto.faas.cloudflare.error_handler' } } ) ;
5250 } else {
5351 DEBUG_BUILD && debug . log ( '[Hono] Not capturing exception because `shouldHandleError` returned `false`.' , err ) ;
You can’t perform that action at this time.
0 commit comments