diff --git a/packages/trpc/server/field-router/router.ts b/packages/trpc/server/field-router/router.ts index 4d14e9de7..2028c37f6 100644 --- a/packages/trpc/server/field-router/router.ts +++ b/packages/trpc/server/field-router/router.ts @@ -636,9 +636,12 @@ export const fieldRouter = router({ // Log the error for debugging purposes. ctx.logger.error({ message: 'Error signing field with token', - error: err instanceof AppError ? `[${err.code}]: ${err.message}` : err, + error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err), }); + // Raw console.log incase we're somehow deailing with a funky error object that doesn't serialize well. + console.log('Error signing field with token', err); + // Rethrow the error so that the client receives the appropriate error response. throw err; } @@ -668,9 +671,11 @@ export const fieldRouter = router({ // Log the error for debugging purposes. ctx.logger.error({ message: 'Error removing signed field with token', - error: err instanceof AppError ? `[${err.code}]: ${err.message}` : err, + error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err), }); + console.log('Error removing signed field with token', err); + // Rethrow the error so that the client receives the appropriate error response. throw err; } diff --git a/packages/trpc/server/recipient-router/router.ts b/packages/trpc/server/recipient-router/router.ts index b6b91a520..e3ba84700 100644 --- a/packages/trpc/server/recipient-router/router.ts +++ b/packages/trpc/server/recipient-router/router.ts @@ -636,9 +636,12 @@ export const recipientRouter = router({ // Log the error for debugging purposes. ctx.logger.error({ message: 'Error completing document with token', - error: err instanceof AppError ? `[${err.code}]: ${err.message}` : err, + error: err instanceof AppError ? `[${err.code}]: ${err.message}` : String(err), }); + // Raw console.log incase we're somehow dealing with a funky error object that doesn't serialize well. + console.log('Error completing document with token', err); + // Rethrow the error so that the client receives the appropriate error response. throw err; }