DI Bag API / index / DiBagServiceReadinessCancelledError
Class: DiBagServiceReadinessCancelledError
Defined in: errors.ts:155
ensureServicesReady stopped waiting on abort or timeout; this container is closing and disposalPromise settles when it has closed. details names what was still in progress. On timeout, cause carries DI_BAG_SERVICE_READINESS_TIMEOUT.
Example
ts
import { DiBag, DiBagServiceReadinessCancelledError } from 'di-bag';
const container = DiBag.createBuilder().withServices({ db: () => new Promise<number>(() => {}) }).buildContainer();
try {
await container.ensureServicesReady(['db'], { totalTimeoutMs: 1_000 });
} catch (error) {
if (error instanceof DiBagServiceReadinessCancelledError) console.error(error.details.acquisitionsStillPending);
}Extends
Error
Constructors
Constructor
ts
new (reason: "aborted" | "timeout", cause: unknown, disposalPromise: Promise<void>, progress: CloseProgress, totalTimeoutMs?: number): DiBagServiceReadinessCancelledError;Defined in: errors.ts:165
Parameters
| Parameter | Description |
|---|---|
reason | Whether an external abort or the deadline cancelled the wait. |
cause | The abort reason or the generated timeout error. |
disposalPromise | Eventual shutdown of this container; cancellation does not await it. |
progress | Labels still in progress when the wait stopped. |
totalTimeoutMs? | The deadline that elapsed, for reason: 'timeout'. |
Overrides
ts
Error.constructorProperties
code
ts
declare readonly code: 'DI_BAG_SERVICE_READINESS_CANCELLED';Defined in: errors.ts:156
details
ts
declare readonly details: Readonly<{
operation: 'ensureServicesReady';
reason: 'aborted' | 'timeout';
totalTimeoutMs?: number;
} & CloseProgress>;Defined in: errors.ts:157
disposalPromise
ts
readonly disposalPromise: Promise<void>;Defined in: errors.ts:168
Eventual shutdown of this container; cancellation does not await it.
reason
ts
readonly reason: 'aborted' | 'timeout';Defined in: errors.ts:166
Whether an external abort or the deadline cancelled the wait.