@darthcav/ts-http-server
    Preparing search index...

    Function defaultErrorHandler

    • Fastify error handler supporting Boom errors and generic errors.

      Negotiates the response format via @fastify/accepts:

      • text/html — renders _error.ejs (requires @fastify/view).
      • application/json — JSON payload.
      • Otherwise — plain-text.

      For Boom errors the HTTP status code and payload come from error.output. For non-Boom errors a 500 is used unless the reply already has a valid 4xx/5xx status; the real error is logged via request.log.error and the client receives only the generic HTTP status reason phrase (e.g. "Internal Server Error"), so internal details are never leaked.

      Parameters

      • error: FastifyError

        The Fastify or Boom error that triggered the handler.

      • request: FastifyRequest

        The Fastify request associated with the error.

      • reply: FastifyReply

        The Fastify reply used to send the error response.

      Returns Promise<void>