TRCPErrorCause
This commit is contained in:
@@ -56,22 +56,52 @@ const mapErrors = <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", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
|
||||
Interrupt: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
|
||||
Fail: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
|
||||
Empty: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
|
||||
Parallel: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
|
||||
Sequential: cause => Effect.fail(
|
||||
new TRPCError({ code: "INTERNAL_SERVER_ERROR", cause })
|
||||
new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
cause: new TRCPErrorCause(cause),
|
||||
})
|
||||
),
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
export class TRCPErrorCause extends Error {
|
||||
constructor(readonly cause: unknown) {
|
||||
super()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user