Skip to content

DI Bag API / index / DiBagDisposalError

Class: DiBagDisposalError ​

Defined in: errors.ts:90

One or more disposers failed during close(); every disposal was still attempted. failures lists each original error with the label of the service it belonged to, in attempt order.

Example ​

ts
import { DiBag, DiBagDisposalError } from 'di-bag';

const container = DiBag.createBuilder().withServices({ value: () => 1 }).buildContainer();
await container.close().catch((error: unknown) => {
  if (error instanceof DiBagDisposalError) for (const failure of error.failures) console.error(failure.bindingLabel, failure.error);
});

Extends ​

  • AggregateError

Constructors ​

Constructor ​

ts
new (failures: readonly DisposalFailure[]): DiBagDisposalError;

Defined in: errors.ts:97

Parameters ​

ParameterDescription
failuresStructured failures whose original errors also populate AggregateError.errors.

Overrides ​

ts
AggregateError.constructor

Properties ​

code ​

ts
declare readonly code: 'DI_BAG_DISPOSAL_FAILED';

Defined in: errors.ts:91


details ​

ts
declare readonly details: Readonly<Record<string, unknown>>;

Defined in: errors.ts:92


failures ​

ts
readonly failures: readonly DisposalFailure[];

Defined in: errors.ts:94

Frozen disposal failures in finalizer invocation order.

Ordinary services. Checked composition. Explicit ownership.