Structured error type returned by all public TestcontainerEx functions.
Pattern-match on :code to handle specific failure modes:
case TestcontainerEx.start_container(config) do
{:ok, container} -> container
{:error, %TestcontainerEx.Error{code: :timeout}} -> handle_timeout()
{:error, %TestcontainerEx.Error{code: :pull_failed} = err} ->
Logger.error("Pull failed: #{err.message}")
end
Summary
Functions
Build a Docker API error.
Build a not-connected error.
Build a port-not-mapped error.
Build a pull failure error.
Build a timeout error with optional context.
Build a wait-strategy failure, including the last container logs.
Wrap an arbitrary error term into a TestcontainerEx.Error if not already one.
Types
@type code() ::
:timeout
| :pull_failed
| :container_start_failed
| :wait_strategy_failed
| :connection_refused
| :docker_api_error
| :image_not_found
| :not_connected
| :port_not_mapped
Functions
Build a Docker API error.
@spec not_connected() :: t()
Build a not-connected error.
Build a port-not-mapped error.
Build a pull failure error.
Build a timeout error with optional context.
Build a wait-strategy failure, including the last container logs.
Wrap an arbitrary error term into a TestcontainerEx.Error if not already one.