DI Bag API / index / DiBagServiceReadinessError
Class: DiBagServiceReadinessError
Defined in: errors.ts:121
ensureServicesReady could not make a listed service ready, and this container is now closed. cause is the original failure and disposalFailures lists disposers that failed while the container closed.
Example
ts
import { DiBag, DiBagServiceReadinessError } from 'di-bag';
const container = DiBag.createBuilder().withServices({ db: async (): Promise<number> => { throw new Error('offline'); } }).buildContainer();
try {
await container.ensureServicesReady(['db']);
} catch (error) {
if (error instanceof DiBagServiceReadinessError) console.error(error.cause, error.disposalFailures);
}Extends
Error
Constructors
Constructor
ts
new (cause: unknown, disposalFailures: readonly DisposalFailure[], disposalError?: unknown | undefined): DiBagServiceReadinessError;Defined in: errors.ts:132
Parameters
| Parameter | Description |
|---|---|
cause | The original failure of a listed service or of one of its dependencies. |
disposalFailures | Structured failures collected while closing the container. |
disposalError? | The complete shutdown error, when closing itself rejected. |
Overrides
ts
Error.constructorProperties
code
ts
declare readonly code: 'DI_BAG_SERVICE_READINESS_FAILED';Defined in: errors.ts:122
details
ts
declare readonly details: Readonly<Record<string, unknown>>;Defined in: errors.ts:123
disposalError?
ts
readonly disposalError?: unknown;Defined in: errors.ts:132
The complete shutdown error, when closing itself rejected.
disposalFailures
ts
readonly disposalFailures: readonly DisposalFailure[];Defined in: errors.ts:125
Frozen disposal failures in invocation order, collected while this container closed.