Juggernaut.Error exception (Juggernaut v0.4.0)

Copy Markdown View Source

An error that stops a task before or instead of a verdict.

The type decides the exit code (Juggernaut.CLI.ExitCode):

  • :usage - a bad flag, an unknown id: exit 2;
  • :config - an invalid .juggernaut.exs or environment: exit 2;
  • :infrastructure - the harness failed (lock held, worker boot, ...): exit 3.

An infrastructure error is never a verdict about the code under test.

Summary

Functions

A configuration error: invalid .juggernaut.exs or refused environment. Exit 2.

An infrastructure or harness error. Exit 3, never scored as a verdict.

The error object of the agent and JSON error document (see the agent output guide): type, message and each detail, all under string keys.

A usage error: bad arguments, unknown ids. Exit 2.

Types

t()

@type t() :: %Juggernaut.Error{
  __exception__: term(),
  details: map(),
  message: String.t(),
  type: type()
}

type()

@type type() :: :usage | :config | :infrastructure

Functions

config(message, details \\ %{})

@spec config(String.t(), map()) :: t()

A configuration error: invalid .juggernaut.exs or refused environment. Exit 2.

infrastructure(message, details \\ %{})

@spec infrastructure(String.t(), map()) :: t()

An infrastructure or harness error. Exit 3, never scored as a verdict.

to_map(error)

@spec to_map(t()) :: %{required(String.t()) => term()}

The error object of the agent and JSON error document (see the agent output guide): type, message and each detail, all under string keys.

usage(message, details \\ %{})

@spec usage(String.t(), map()) :: t()

A usage error: bad arguments, unknown ids. Exit 2.