mapErrorsToTRPC
This commit is contained in:
@@ -30,19 +30,19 @@ export module TRPCContextCreator {
|
||||
}
|
||||
|
||||
|
||||
const mapEffectErrorsToTRPC = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
||||
const mapErrorsToTRPC = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
||||
Effect.sandbox(effect).pipe(
|
||||
Effect.catchTags({
|
||||
Die: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR" })
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
),
|
||||
|
||||
Interrupt: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR" })
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
),
|
||||
|
||||
Fail: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR" })
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
),
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user