From 07ecf5ad0be9a9733768da4029263edf8e356b62 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Mon, 30 Sep 2024 15:10:35 +0300 Subject: [PATCH] cleanup --- lib/errors/errorHandler.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/errors/errorHandler.ts b/lib/errors/errorHandler.ts index a24403d..07f5a59 100644 --- a/lib/errors/errorHandler.ts +++ b/lib/errors/errorHandler.ts @@ -6,13 +6,14 @@ import { isPublicNonRecoverableError, isStandardizedError, } from '@lokalise/node-core' -import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify' +import type { FastifyReply, FastifyRequest } from 'fastify' import { hasZodFastifySchemaValidationErrors, isResponseSerializationError, } from 'fastify-type-provider-zod' import pino from 'pino' import type { ZodError } from 'zod' +import type { AnyFastifyInstance } from '../plugins/pluginsCommon' // biome-ignore lint/suspicious/noExplicitAny: export type FreeformRecord = Record @@ -128,16 +129,16 @@ export type ErrorHandlerParams = { resolveLogObject?: (error: unknown) => FreeformRecord | undefined } -export function createErrorHandler(params: ErrorHandlerParams): ( - // biome-ignore lint/suspicious/noExplicitAny: We should support any fastify instance generics - this: FastifyInstance, +export function createErrorHandler( + params: ErrorHandlerParams, +): ( + this: AnyFastifyInstance, error: FreeformRecord, request: FastifyRequest, reply: FastifyReply, ) => void { return function errorHandler( - // biome-ignore lint/suspicious/noExplicitAny: We should support any fastify instance generics - this: FastifyInstance, + this: AnyFastifyInstance, error: FreeformRecord, request: FastifyRequest, reply: FastifyReply,