Skip to content

Feature request: export typed errors (e.g. TarnError) for pool async failures #83

@erehulka

Description

@erehulka

Problem

PendingOperation.abort() rejects with new Error('aborted') — a generic Error. Timeouts use TimeoutError, which already supports instanceof, but abort does not. Downstream (e.g. DB drivers using tarn) cannot reliably classify pool teardown / aborted acquire without checking message or stack traces.

Proposal

  1. Add a base class TarnError extending Error (set name; optional stable code for cross-bundle checks).
  2. Replace new Error('aborted') with the new class (new TarnError('aborted')), keeping the same default message where possible for backward compatibility.
  3. Consider making TimeoutError extend TarnError so err instanceof TarnError covers both timeouts and aborts.

This change maintains backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions