Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Sep 30, 2024
1 parent 4e6a6e0 commit 07ecf5a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/errors/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: <explanation>
export type FreeformRecord = Record<string, any>
Expand Down Expand Up @@ -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<any, any, any, any, any>,
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<any, any, any, any, any>,
this: AnyFastifyInstance,
error: FreeformRecord,
request: FastifyRequest,
reply: FastifyReply,
Expand Down

0 comments on commit 07ecf5a

Please sign in to comment.