Context
Steve, 2026-09-27: a network component can fail after it has started (a postgres client emits an error). Passing the system into the component so it can call stop() is clumsy and gives it too much power. The system should be told, and the application should decide.
Behaviour
- A start function receives
(components, { signal, fail }). Breaking change to the second argument; released as 0.2.0.
fail(error) while the component's own start is in flight deems that start failed, exactly as its own timeout does: component_start_failed carries the error, the rest are skipped as failure, the system stops, start() rejects.
fail(error) after the component started but while start() is still in flight announces component_failed with { name, error }, then fails the start with that error: the unreached are skipped as failure, the started (the failed component included) are stopped, start() rejects with the error.
fail(error) once start() has resolved announces component_failed and nothing else. The application restarts, stops or ignores.
fail after the component has stopped is ignored. fail twice announces twice. exitOn does not react.
Not covered
A component which does not notice the error and completes its start after being deemed failed has its stop skipped, as a timed-out one does today.
Context
Steve, 2026-09-27: a network component can fail after it has started (a postgres client emits an error). Passing the system into the component so it can call stop() is clumsy and gives it too much power. The system should be told, and the application should decide.
Behaviour
(components, { signal, fail }). Breaking change to the second argument; released as 0.2.0.fail(error)while the component's own start is in flight deems that start failed, exactly as its own timeout does:component_start_failedcarries the error, the rest are skipped asfailure, the system stops,start()rejects.fail(error)after the component started but whilestart()is still in flight announcescomponent_failedwith{ name, error }, then fails the start with that error: the unreached are skipped asfailure, the started (the failed component included) are stopped,start()rejects with the error.fail(error)oncestart()has resolved announcescomponent_failedand nothing else. The application restarts, stops or ignores.failafter the component has stopped is ignored.failtwice announces twice.exitOndoes not react.Not covered
A component which does not notice the error and completes its start after being deemed failed has its stop skipped, as a timed-out one does today.