Skip to main content

CommonError

Enum CommonError 

Source
pub enum CommonError {
    Io(Error),
    Config(String),
    NotFound(String),
    AlreadyExists(String),
    InvalidState(String),
    Timeout(String),
    PermissionDenied(String),
    Internal(String),
}
Expand description

Common errors that occur across multiple ArcBox crates.

This enum provides a unified set of error variants for common scenarios like I/O errors, configuration issues, and resource lookup failures. Crate-specific errors should wrap this type using #[from] attribute.

Variants§

§

Io(Error)

I/O error from the standard library.

This is the most common error type, wrapping std::io::Error for filesystem operations, network I/O, and other system calls.

§

Config(String)

Configuration error.

Indicates invalid or missing configuration values, malformed config files, or configuration validation failures.

§

NotFound(String)

Resource not found.

Used when a requested resource (container, image, volume, network, etc.) does not exist in the system.

§

AlreadyExists(String)

Resource already exists.

Used when attempting to create a resource that already exists.

§

InvalidState(String)

Invalid state transition.

Indicates that an operation was attempted on a resource that is not in a valid state for that operation (e.g., stopping an already stopped container).

§

Timeout(String)

Operation timeout.

Used when an operation exceeds its allowed time limit.

§

PermissionDenied(String)

Permission denied.

Used when an operation fails due to insufficient permissions.

§

Internal(String)

Internal error.

A catch-all for unexpected internal errors. Should include enough context for debugging.

Implementations§

Source§

impl CommonError

Source

pub fn config(msg: impl Into<String>) -> Self

Creates a new configuration error.

Source

pub fn not_found(resource: impl Into<String>) -> Self

Creates a new not found error.

Source

pub fn already_exists(resource: impl Into<String>) -> Self

Creates a new already exists error.

Source

pub fn invalid_state(msg: impl Into<String>) -> Self

Creates a new invalid state error.

Source

pub fn timeout(msg: impl Into<String>) -> Self

Creates a new timeout error.

Source

pub fn permission_denied(resource: impl Into<String>) -> Self

Creates a new permission denied error.

Source

pub fn internal(msg: impl Into<String>) -> Self

Creates a new internal error.

Source

pub const fn is_io(&self) -> bool

Returns true if this is an I/O error.

Source

pub const fn is_not_found(&self) -> bool

Returns true if this is a not found error.

Source

pub const fn is_already_exists(&self) -> bool

Returns true if this is an already exists error.

Source

pub const fn is_timeout(&self) -> bool

Returns true if this is a timeout error.

Trait Implementations§

Source§

impl Debug for CommonError

Source§

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

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

impl Display for CommonError

Source§

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

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

impl Error for CommonError

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<Error> for CommonError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.