bsdkrun/error

The single error type returned by every fallible function in the SDK.

Types

Why a call failed.

  • BinaryNotFound — the bsdkrun binary could not be located; carries every path that was searched.
  • CommandFailed — a bsdkrun invocation exited non-zero; carries the exit code, both captured streams, and a label naming the command.
  • SandboxNotFound — no machine matched the given id or prefix.
  • DecodeFailedbsdkrun --json produced output the SDK could not decode; carries the raw text.
  • InvalidOptions — the create options were internally inconsistent, e.g. a required field left empty.
  • GraphqlError — talking to a remote bsdkrund through bsdkrun/client failed: a resolver returned a GraphQL error, the response could not be parsed, or the daemon could not be reached at all. code carries the GraphQL extensions.code the daemon sent, when there was one.
  • AuthError — the daemon rejected the bearer token: an HTTP 401, a GraphQL error whose extensions.code is "UNAUTHENTICATED", or a subscription socket that closed before connection_ack ever arrived.

The last two are only ever produced by bsdkrun/client (the remote GraphQL client added alongside the local, CLI-shelling API this type was originally written for) — every other function in this SDK only produces the first five.

pub type Error {
  BinaryNotFound(searched: List(String))
  CommandFailed(
    exit_code: Int,
    stdout: String,
    stderr: String,
    label: String,
  )
  SandboxNotFound(id: String)
  DecodeFailed(label: String, raw: String)
  InvalidOptions(message: String)
  GraphqlError(message: String, code: option.Option(String))
  AuthError(message: String)
}

Constructors

  • BinaryNotFound(searched: List(String))
  • CommandFailed(
      exit_code: Int,
      stdout: String,
      stderr: String,
      label: String,
    )
  • SandboxNotFound(id: String)
  • DecodeFailed(label: String, raw: String)
  • InvalidOptions(message: String)
  • GraphqlError(message: String, code: option.Option(String))
  • AuthError(message: String)

Values

pub fn to_string(error: Error) -> String

A human-readable, single-block rendering of an error — the string you would print or log.

Search Document