diff --git a/packages/server/src/trpc/TRPCContextCreator.ts b/packages/server/src/trpc/TRPCContextCreator.ts index 5b2bd55..776d4c5 100644 --- a/packages/server/src/trpc/TRPCContextCreator.ts +++ b/packages/server/src/trpc/TRPCContextCreator.ts @@ -30,19 +30,19 @@ export module TRPCContextCreator { } -const mapEffectErrorsToTRPC = (effect: Effect.Effect) => +const mapErrorsToTRPC = (effect: Effect.Effect) => 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 }) ), }) )