lud
Force full crash of Bandit in case of error
Hello,
In our tests we are mocking http servers to assert different things about sent http requests. This is the child spec that we use:
Supervisor.child_spec(
{Bandit,
plug: {MockablePlug, spec},
scheme: :http,
port: 0,
thousand_island_options: [num_acceptors: 10, num_connections: 2]},
id: {__MODULE__, spec.id}
)
There is nothing notable about MockablePlug except that it rescues exceptions to log different things, and then reraises them.
We use that spec with start_link_supervised! in order to fail our test if our ad-hoc http server fails. The problem we face is that there is a layer of supervision that prevents our test from failing.
I would like to know if there is a builtin mechanism to force the whole Bandit instance to crash when the http handler does. I understand that this is the opposite of what we would generally want so I would not be surprised if there is not.
The handlers seem to be dynamically started so I cannot manually link it to the test process before calling it.
Thank you ![]()
(pinging @mtrudel )
First Post!
LostKobrakai
Crashing an individual handler is generally not meant to propagate to the whole server, so this behavior probably expected.
I guess you could register a telemetry handler to catch handlers crashing from exceptions.







