Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 26 variants CommandExit(CommandResult), NotFound { what: String, name: String, }, InvalidPath { path: String, reason: String, }, Timeout { op: String, detail: String, result: Option<CommandResult>, }, Busy { cause: Box<Error>, }, LimitReached { message: String, }, OutcomeUnknown { cause: Option<Box<Error>>, result: Option<CommandResult>, }, NotEnabled { cause: Box<Error>, }, TermsNotAccepted { missing: Vec<TermsDocument>, }, GitHubLinkRequired { organization: String, }, GitHubAppNotInstalled { install_url: String, cause: Box<Error>, }, Rpc(Status), Platform { context: String, error: PlatformError, }, Http { context: String, status: u16, message: String, }, Transport { context: String, message: String, }, LoginRequired { detail: Option<String>, }, LoginExpired { detail: String, }, AccountNotFound, NoOrganization, AmbiguousOrganization { organizations: Vec<Organization>, }, NoInstance { detection: Option<String>, }, Ambiguous { reference: String, }, Exit { exit_code: i32, timed_out: bool, stdout: Vec<u8>, stderr: Vec<u8>, }, Detached, Io { context: String, source: Arc<Error>, }, Other(String),
}
Expand description

Everything that can go wrong. The variants mirror the typed errors of the Go, Python and TypeScript SDKs (CommandExitError, NotFoundError, ErrBusy, …).

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

CommandExit(CommandResult)

A command exited with a non-zero code. Holds the full result.

§

NotFound

A file, directory, path, background command or sandbox does not exist. what is “file”, “directory”, “path”, “command”, “sandbox” or “session”.

Fields

§what: String
§name: String
§

InvalidPath

The path exists but is the wrong kind; reason is “is a directory” or “not a directory”.

Fields

§path: String
§reason: String
§

Timeout

A deadline passed. op is “command”, “start” or “kill”. For a command, result holds the output received before it was stopped.

Fields

§detail: String
§

Busy

The sandbox is held by another controller, typically an interactive shell attached with chainctl. Commands can’t run until it detaches.

Fields

§cause: Box<Error>
§

LimitReached

The organization is at its session limit. Kill a sandbox first.

Fields

§message: String
§

OutcomeUnknown

The connection ended, or failed, before the command reported an exit status. It may or may not have run, in part or in full. cause is the transport error, when there was one; result holds the output received before the stream ended.

Fields

§cause: Option<Box<Error>>
§

NotEnabled

Workspaces is not turned on for the organization. An owner can turn it on with enable_workspaces or chainguard-sandbox enable.

Fields

§cause: Box<Error>
§

TermsNotAccepted

The organization has not accepted the legal documents Workspaces is offered under. enable_workspaces accepts them when accept_terms is set.

Fields

§

GitHubLinkRequired

The organization has no GitHub account linked, which the service requires before it turns Workspaces on, and enabling was not allowed to open a browser to link one.

Fields

§organization: String
§

GitHubAppNotInstalled

The Chainguard GitHub App is not installed on the GitHub account being linked. Install it at install_url, then enable again.

Fields

§install_url: String
§cause: Box<Error>
§

Rpc(Status)

The sandbox plane answered a call with a gRPC error.

§

Platform

The platform (account) API answered with an error. context says which call.

Fields

§context: String
§

Http

An HTTP call answered with an error status.

Fields

§context: String
§status: u16
§message: String
§

Transport

An HTTP or gRPC connection could not be made or broke off.

Fields

§context: String
§message: String
§

LoginRequired

There is no saved login and the token source may not open a browser.

Fields

§detail: Option<String>
§

LoginExpired

The saved login was refused (expired, revoked or already spent); log in again.

Fields

§detail: String
§

AccountNotFound

The issuer knows no Chainguard account for the person who logged in.

§

NoOrganization

The identity belongs to no Chainguard organization.

§

AmbiguousOrganization

The identity belongs to several organizations; choose one explicitly.

Fields

§organizations: Vec<Organization>
§

NoInstance

No organization was set and none could be detected. detection says why detection didn’t pick one.

Fields

§detection: Option<String>
§

Ambiguous

A session reference matched more than one session.

Fields

§reference: String
§

Exit

A lower-level helper (output, shell, write_file) ran a command that exited non-zero or timed out.

Fields

§exit_code: i32
§timed_out: bool
§stdout: Vec<u8>
§stderr: Vec<u8>
§

Detached

Another client attached to the session and took it over during the first attach.

§

Io

A local file operation failed.

Fields

§context: String
§source: Arc<Error>
§

Other(String)

Anything else, described by its message.

Implementations§

Source§

impl Error

Source

pub fn grpc_code(&self) -> Option<Code>

The gRPC status code behind the error, looking through Busy, NotEnabled, OutcomeUnknown and GitHubAppNotInstalled (like Go’s status.Code(err)).

Source

pub fn platform_error(&self) -> Option<&PlatformError>

The platform API’s error, if this is (or wraps) one.

Source

pub fn command_result(&self) -> Option<&CommandResult>

The command result an error carries: a non-zero exit, a timeout, or the partial output of a command whose outcome is unknown.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Error

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Status> for Error

Source§

fn from(s: Status) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl !UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more