Bsdkrun.Error exception (bsdkrun_ex v0.1.0)

Copy Markdown View Source

The single exception type raised (or returned in {:error, _} tuples) by the SDK. kind discriminates the failure:

  • :binary_not_found — the bsdkrun binary could not be located.
  • :command_failed — a bsdkrun invocation exited non-zero. Carries exit_code, stdout, stderr, and the label of the command.
  • :sandbox_not_found — no machine matched the given id / prefix.

Summary

Types

The category of failure this error represents.

t()

Functions

Build a :binary_not_found error listing the paths that were searched.

Build a :command_failed error from a captured CLI result.

Build a :sandbox_not_found error for the given id / prefix.

Types

kind()

@type kind() :: :binary_not_found | :command_failed | :sandbox_not_found

The category of failure this error represents.

t()

@type t() :: %Bsdkrun.Error{
  __exception__: true,
  exit_code: integer() | nil,
  kind: kind(),
  label: String.t() | nil,
  message: String.t(),
  searched: [String.t()] | nil,
  stderr: String.t() | nil,
  stdout: String.t() | nil
}

Functions

binary_not_found(searched)

@spec binary_not_found([String.t()]) :: t()

Build a :binary_not_found error listing the paths that were searched.

command_failed(exit_code, stdout, stderr, label)

@spec command_failed(integer(), String.t(), String.t(), String.t()) :: t()

Build a :command_failed error from a captured CLI result.

sandbox_not_found(id)

@spec sandbox_not_found(String.t()) :: t()

Build a :sandbox_not_found error for the given id / prefix.