diff --git a/packages/server/src/trpc/TRPCContextCreator.ts b/packages/server/src/trpc/TRPCContextCreator.ts
index 67df8c2..3a104c2 100644
--- a/packages/server/src/trpc/TRPCContextCreator.ts
+++ b/packages/server/src/trpc/TRPCContextCreator.ts
@@ -56,22 +56,52 @@ const mapErrors = (effect: Effect.Effect) =>
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()
+ }
+}