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
- Add a base class
TarnError extending Error (set name; optional stable code for cross-bundle checks).
- Replace
new Error('aborted') with the new class (new TarnError('aborted')), keeping the same default message where possible for backward compatibility.
- Consider making
TimeoutError extend TarnError so err instanceof TarnError covers both timeouts and aborts.
This change maintains backwards compatibility.
Problem
PendingOperation.abort()rejects withnew Error('aborted')— a genericError. Timeouts useTimeoutError, which already supportsinstanceof, but abort does not. Downstream (e.g. DB drivers using tarn) cannot reliably classify pool teardown / aborted acquire without checkingmessageor stack traces.Proposal
TarnErrorextendingError(setname; optional stablecodefor cross-bundle checks).new Error('aborted')with the new class (new TarnError('aborted')), keeping the same defaultmessagewhere possible for backward compatibility.TimeoutErrorextendTarnErrorsoerr instanceof TarnErrorcovers both timeouts and aborts.This change maintains backwards compatibility.