#[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
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”.
InvalidPath
The path exists but is the wrong kind; reason is “is a directory” or “not a directory”.
Timeout
A deadline passed. op is “command”, “start” or “kill”. For a command, result holds the
output received before it was stopped.
Busy
The sandbox is held by another controller, typically an interactive shell attached with chainctl. Commands can’t run until it detaches.
LimitReached
The organization is at its session limit. Kill a sandbox first.
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.
NotEnabled
Workspaces is not turned on for the organization. An owner can turn it on with
enable_workspaces or chainguard-sandbox enable.
TermsNotAccepted
The organization has not accepted the legal documents Workspaces is offered under.
enable_workspaces accepts them when accept_terms is set.
Fields
missing: Vec<TermsDocument>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.
GitHubAppNotInstalled
The Chainguard GitHub App is not installed on the GitHub account being linked. Install it
at install_url, then enable again.
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.
Http
An HTTP call answered with an error status.
Transport
An HTTP or gRPC connection could not be made or broke off.
LoginRequired
There is no saved login and the token source may not open a browser.
LoginExpired
The saved login was refused (expired, revoked or already spent); log in again.
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.
Ambiguous
A session reference matched more than one session.
Exit
A lower-level helper (output, shell, write_file) ran a command that exited non-zero
or timed out.
Detached
Another client attached to the session and took it over during the first attach.
Io
A local file operation failed.
Other(String)
Anything else, described by its message.
Implementations§
Source§impl Error
impl Error
Sourcepub fn grpc_code(&self) -> Option<Code>
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)).
Sourcepub fn platform_error(&self) -> Option<&PlatformError>
pub fn platform_error(&self) -> Option<&PlatformError>
The platform API’s error, if this is (or wraps) one.
Sourcepub fn command_result(&self) -> Option<&CommandResult>
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 Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].