Errors and Boundaries

Product outcome: Misconfiguration and unsupported usage should fail with specific, diagnosable errors.

This page summarizes the user-facing error boundaries described by specs/epics/errors-and-boundaries.md.

Use DependencyNotFoundError to distinguish dependency configuration problems from application runtime failures.

Expected behavior:

TypeScript
import { Container, DependencyNotFoundError } from 'ts-ioc-container';

const container = new Container();

try {
container.resolve('IUserRepository');
} catch (error) {
console.log(error instanceof DependencyNotFoundError); // true
}
import { Container, DependencyNotFoundError } from 'ts-ioc-container';

const container = new Container();

try {
container.resolve('IUserRepository');
} catch (error) {
console.log(error instanceof DependencyNotFoundError); // true
}

Registrations must have a key before they are applied to a container.

Expected behavior:

A disposed container or scope is closed for further use.

Expected behavior:

TypeScript
import { Container, ContainerDisposedError } from 'ts-ioc-container';

const requestScope = new Container({ tags: ['request'] });
requestScope.dispose();

try {
requestScope.resolve('IRequestContext');
} catch (error) {
console.log(error instanceof ContainerDisposedError); // true
}
import { Container, ContainerDisposedError } from 'ts-ioc-container';

const requestScope = new Container({ tags: ['request'] });
requestScope.dispose();

try {
requestScope.resolve('IRequestContext');
} catch (error) {
console.log(error instanceof ContainerDisposedError); // true
}

Some API shapes intentionally do not support every modifier.

Expected behavior:

EmptyContainer is the parent-chain terminator used by root containers.

Expected behavior:

The product spec is accepted in:

The executable acceptance spec is: