From a04cd49d03eaf309fee8052abc9cd445f3bbd69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Wed, 10 Jul 2024 05:02:30 +0200 Subject: [PATCH] mapErrorsToTRPC --- packages/server/src/trpc/TRPCContextCreator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 }) ), }) )