mirror of
https://github.com/documenso/documenso.git
synced 2025-11-18 18:51:37 +10:00
fix: wip
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import type { ErrorHandlerOptions } from '@trpc/server/unstable-core-do-not-import';
|
||||
|
||||
import { AppError, AppErrorCode } from '@documenso/lib/errors/app-error';
|
||||
import { env } from '@documenso/lib/utils/env';
|
||||
import { buildLogger } from '@documenso/lib/utils/logger';
|
||||
|
||||
const logger = buildLogger();
|
||||
@ -10,8 +11,10 @@ export const handleTrpcRouterError = (
|
||||
{ error, path }: Pick<ErrorHandlerOptions<undefined>, 'error' | 'path'>,
|
||||
source: 'trpc' | 'apiV1' | 'apiV2',
|
||||
) => {
|
||||
// Always log the error for now.
|
||||
console.error(error);
|
||||
// Always log the error on production for now.
|
||||
if (env('NODE_ENV') !== 'development') {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
const appError = AppError.parseError(error.cause || error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user