This commit is contained in:
Julien Valverdé
2024-07-15 02:22:40 +02:00
parent 63f636f231
commit 3ae5f31f96

View File

@@ -58,7 +58,7 @@ const mapErrors = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
Empty: cause => Effect.fail(
new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
@@ -67,7 +67,7 @@ const mapErrors = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
? cause.error
: new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
@@ -76,35 +76,34 @@ const mapErrors = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
? cause.defect
: new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
Interrupt: cause => Effect.fail(
new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
Sequential: cause => Effect.fail(
new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
Parallel: cause => Effect.fail(
new TRPCError({
code: "INTERNAL_SERVER_ERROR",
cause: new TRCPErrorCause(cause),
cause: new TRPCErrorCause(cause),
})
),
})
)
export class TRCPErrorCause<E> extends Error {
export class TRPCErrorCause<E> extends Error {
constructor(readonly cause: Cause.Cause<E>) {
super()
}