Skip to content

unhandledRejection handler swallows errors without exiting #12

Description

@DeFiVC

What

The handler logs the rejection but does not call process.exit(1):

process.on("unhandledRejection", (reason) => {
    logger.error({ reason }, "Unhandled promise rejection");
});

In Node.js 15+, unhandled rejections crash the process by default. This handler overrides that safety net, allowing the process to continue in a potentially corrupted state.

Why

A database connection leak, an unhandled promise in event processing, or any other async error would be silently swallowed while the process continues operating.

Scope

  • Call process.exit(1) after logging
  • Or implement a more sophisticated error recovery

Acceptance Criteria

  • Unhandled rejections cause the process to exit
  • Errors are logged before exit

Technical Context

  • File: src/index.ts, lines 78-80

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions