@@ -42,7 +42,7 @@ export const badChainError = (chain: string | number): CustomError =>
4242 "INVALID_CHAIN" ,
4343 ) ;
4444
45- const flipObject = ( data : any ) =>
45+ const flipObject = ( data : object ) =>
4646 Object . fromEntries ( Object . entries ( data ) . map ( ( [ key , value ] ) => [ value , key ] ) ) ;
4747
4848const isZodError = ( err : unknown ) : boolean => {
@@ -72,15 +72,15 @@ export function withErrorHandler(server: FastifyInstance) {
7272 message : "code" in error ? error . code : error . message ,
7373 reason : error . message ,
7474 statusCode : 400 ,
75- stack : env . NODE_ENV !== "production" ? error . stack : undefined ,
75+ stack : env . NODE_ENV === "production" ? undefined : error . stack ,
7676 } ,
7777 } ) ;
7878 }
7979
8080 // Zod Typings Errors
8181 if ( isZodError ( error ) ) {
8282 const _error = error as ZodError ;
83- let parsedMessage : any [ ] = [ ] ;
83+ let parsedMessage : unknown ;
8484
8585 try {
8686 parsedMessage = JSON . parse ( _error . message ) ;
@@ -98,7 +98,7 @@ export function withErrorHandler(server: FastifyInstance) {
9898 message : errorObject . message ?? "Invalid Request" ,
9999 reason : errorObject ?? undefined ,
100100 statusCode : 400 ,
101- stack : env . NODE_ENV !== "production" ? _error . stack : undefined ,
101+ stack : env . NODE_ENV === "production" ? undefined : _error . stack ,
102102 } ,
103103 } ) ;
104104 }
@@ -118,7 +118,7 @@ export function withErrorHandler(server: FastifyInstance) {
118118 code,
119119 message,
120120 statusCode,
121- stack : env . NODE_ENV !== "production" ? error . stack : undefined ,
121+ stack : env . NODE_ENV === "production" ? undefined : error . stack ,
122122 } ,
123123 } ) ;
124124 }
@@ -128,7 +128,7 @@ export function withErrorHandler(server: FastifyInstance) {
128128 statusCode : 500 ,
129129 code : "INTERNAL_SERVER_ERROR" ,
130130 message : error . message || ReasonPhrases . INTERNAL_SERVER_ERROR ,
131- stack : env . NODE_ENV !== "production" ? error . stack : undefined ,
131+ stack : env . NODE_ENV === "production" ? undefined : error . stack ,
132132 } ,
133133 } ) ;
134134 } ,
0 commit comments