11/* eslint-disable @typescript-eslint/no-explicit-any */
22/* eslint-disable @typescript-eslint/no-unsafe-argument */
33import * as Sentry from "@sentry/browser"
4- import { Cause , Effect , LogLevel } from "effect-app"
4+ import { Cause , Effect , type LogLevel } from "effect-app"
55import { CauseException , tryToJson , tryToReport } from "effect-app/client/errors"
66import { dropUndefined , LogLevelToSentry } from "effect-app/utils"
77
@@ -19,36 +19,36 @@ export function reportError(
1919 return (
2020 cause : Cause . Cause < unknown > ,
2121 extras ?: Record < string , unknown > ,
22- level : LogLevel . LogLevel = LogLevel . Error
22+ level : LogLevel . LogLevel = " Error"
2323 ) : Effect . Effect < unknown , never , never > =>
2424 Effect
2525 . gen ( function * ( ) {
26- if ( Cause . isInterruptedOnly ( cause ) ) {
26+ if ( Cause . hasInterruptsOnly ( cause ) ) {
2727 yield * Effect . logDebug ( "Interrupted" ) . pipe ( Effect . annotateLogs ( "extras" , JSON . stringify ( extras ?? { } ) ) )
2828 return Cause . squash ( cause )
2929 }
3030
3131 const error = tryCauseException ( cause , name )
3232 yield * reportSentry ( error , extras , LogLevelToSentry ( level ) )
3333 yield * Effect
34- . logWithLevel ( level , "Reporting error" , cause )
34+ . logWithLevel ( level as LogLevel . Severity ) ( "Reporting error" , cause )
3535 . pipe (
3636 Effect . annotateLogs ( dropUndefined ( {
3737 extras,
3838 error : tryToReport ( error ) ,
3939 cause : tryToJson ( cause ) ,
4040 __error_name__ : name
4141 } ) ) ,
42- Effect . catchAllCause ( ( cause ) => Effect . logWarning ( "Failed to log error" , cause ) ) ,
43- Effect . catchAllCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
42+ Effect . catchCause ( ( cause ) => Effect . logWarning ( "Failed to log error" , cause ) ) ,
43+ Effect . catchCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
4444 )
4545
4646 return error
4747 } )
4848 . pipe (
49- Effect . tapErrorCause ( ( cause ) =>
49+ Effect . tapCause ( ( cause ) =>
5050 Effect . logError ( "Failed to report error" , cause ) . pipe (
51- Effect . tapErrorCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
51+ Effect . tapCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
5252 )
5353 )
5454 )
@@ -75,7 +75,7 @@ export function logError<E>(
7575 return ( cause : Cause . Cause < E > , extras ?: Record < string , unknown > ) =>
7676 Effect
7777 . gen ( function * ( ) {
78- if ( Cause . isInterruptedOnly ( cause ) ) {
78+ if ( Cause . hasInterruptsOnly ( cause ) ) {
7979 yield * Effect . logDebug ( "Interrupted" ) . pipe ( Effect . annotateLogs ( dropUndefined ( { extras } ) ) )
8080 return
8181 }
@@ -90,9 +90,9 @@ export function logError<E>(
9090 )
9191 } )
9292 . pipe (
93- Effect . tapErrorCause ( ( cause ) =>
93+ Effect . tapCause ( ( cause ) =>
9494 Effect . logError ( "Failed to log error" , cause ) . pipe (
95- Effect . tapErrorCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
95+ Effect . tapCause ( ( ) => Effect . logFatal ( "Failed to log error cause" ) )
9696 )
9797 )
9898 )
0 commit comments