Skip to content

crash: errors thrown in a hook and then rethrown by an error handler crash fastify #5220

@domdomegg

Description

@domdomegg

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.25.1

Plugin version

No response

Node.js version

21.2.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

14

Description

With the following setup:

- errorHandler (outer)
- register plugin:
  - errorHandler that throws (inner)
  - hook that throws

When the hook executes, the server crashes.

Steps to Reproduce

https://github.com/domdomegg/fastify-crash-mre

Expected Behavior

The server calls the hook, then the inner errorHandler, then the errorHandler.

However, it actually calls the hook, then the inner errorHandler, then crashes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions