pub enum Error {
Config {
code: ErrorCode,
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Signal {
code: ErrorCode,
message: String,
signal: Option<i32>,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Shutdown {
code: ErrorCode,
message: String,
timeout_ms: Option<u64>,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Subsystem {
code: ErrorCode,
name: String,
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Io {
code: ErrorCode,
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
ResourceExhausted {
code: ErrorCode,
resource: String,
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Timeout {
code: ErrorCode,
operation: String,
timeout_ms: u64,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
InvalidState {
code: ErrorCode,
message: String,
current_state: Option<String>,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Platform {
code: ErrorCode,
message: String,
platform: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Runtime {
code: ErrorCode,
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
}
Expand description
Comprehensive error type for all daemon operations.
Variants§
Config
Configuration-related errors
Fields
code: ErrorCode
Error code for structured error handling
Signal
Signal handling errors
Fields
code: ErrorCode
Error code for structured error handling
Shutdown
Shutdown coordination errors
Fields
code: ErrorCode
Error code for structured error handling
Subsystem
Subsystem management errors
Fields
code: ErrorCode
Error code for structured error handling
Io
I/O operation errors
Fields
code: ErrorCode
Error code for structured error handling
ResourceExhausted
Resource exhaustion errors
Fields
code: ErrorCode
Error code for structured error handling
Timeout
Timeout errors
Fields
code: ErrorCode
Error code for structured error handling
InvalidState
Invalid state errors
Fields
code: ErrorCode
Error code for structured error handling
Platform
Platform-specific errors
Fields
code: ErrorCode
Error code for structured error handling
Runtime
Runtime errors
Implementations§
Source§impl Error
impl Error
Sourcepub fn signal_with_number<S: Into<String>>(message: S, signal: i32) -> Self
pub fn signal_with_number<S: Into<String>>(message: S, signal: i32) -> Self
Create a new signal error with signal number.
Sourcepub fn signal_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
pub fn signal_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
Create a new signal error with specific code.
Sourcepub fn shutdown_timeout<S: Into<String>>(message: S, timeout_ms: u64) -> Self
pub fn shutdown_timeout<S: Into<String>>(message: S, timeout_ms: u64) -> Self
Create a new shutdown error with timeout.
Sourcepub fn shutdown_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
pub fn shutdown_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
Create a new shutdown error with specific error code.
Sourcepub fn subsystem<S: Into<String>, M: Into<String>>(name: S, message: M) -> Self
pub fn subsystem<S: Into<String>, M: Into<String>>(name: S, message: M) -> Self
Create a new subsystem error.
Sourcepub fn subsystem_with_code<S: Into<String>, M: Into<String>>(
code: ErrorCode,
name: S,
message: M,
) -> Self
pub fn subsystem_with_code<S: Into<String>, M: Into<String>>( code: ErrorCode, name: S, message: M, ) -> Self
Create a new subsystem error with specific error code.
Sourcepub fn io_with_source<S: Into<String>, E: Error + Send + Sync + 'static>(
message: S,
source: E,
) -> Self
pub fn io_with_source<S: Into<String>, E: Error + Send + Sync + 'static>( message: S, source: E, ) -> Self
Create a new I/O error with source error.
Sourcepub fn runtime_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
pub fn runtime_with_code<S: Into<String>>(code: ErrorCode, message: S) -> Self
Create a new runtime error with specific code.
Sourcepub fn runtime_with_source<S: Into<String>, E: Error + Send + Sync + 'static>(
message: S,
source: E,
) -> Self
pub fn runtime_with_source<S: Into<String>, E: Error + Send + Sync + 'static>( message: S, source: E, ) -> Self
Create a new runtime error with source error.
Sourcepub fn resource_exhausted<S: Into<String>, M: Into<String>>(
resource: S,
message: M,
) -> Self
pub fn resource_exhausted<S: Into<String>, M: Into<String>>( resource: S, message: M, ) -> Self
Create a new resource exhausted error.
Sourcepub fn resource_exhausted_with_code<S: Into<String>, M: Into<String>>(
code: ErrorCode,
resource: S,
message: M,
) -> Self
pub fn resource_exhausted_with_code<S: Into<String>, M: Into<String>>( code: ErrorCode, resource: S, message: M, ) -> Self
Create a new resource exhausted error with specific code.
Sourcepub fn timeout<S: Into<String>>(operation: S, timeout_ms: u64) -> Self
pub fn timeout<S: Into<String>>(operation: S, timeout_ms: u64) -> Self
Create a new timeout error.
Sourcepub fn timeout_with_source<S: Into<String>, E: Error + Send + Sync + 'static>(
operation: S,
timeout_ms: u64,
source: E,
) -> Self
pub fn timeout_with_source<S: Into<String>, E: Error + Send + Sync + 'static>( operation: S, timeout_ms: u64, source: E, ) -> Self
Create a new timeout error with specific code and source.
Sourcepub fn invalid_state<S: Into<String>>(message: S) -> Self
pub fn invalid_state<S: Into<String>>(message: S) -> Self
Create a new invalid state error.
Sourcepub fn invalid_state_with_current<S: Into<String>, C: Into<String>>(
message: S,
current_state: C,
) -> Self
pub fn invalid_state_with_current<S: Into<String>, C: Into<String>>( message: S, current_state: C, ) -> Self
Create a new invalid state error with current state.
Sourcepub fn invalid_state_with_code<S: Into<String>>(
code: ErrorCode,
message: S,
) -> Self
pub fn invalid_state_with_code<S: Into<String>>( code: ErrorCode, message: S, ) -> Self
Create a new invalid state error with specific code.
Sourcepub fn platform<S: Into<String>, P: Into<String>>(
message: S,
platform: P,
) -> Self
pub fn platform<S: Into<String>, P: Into<String>>( message: S, platform: P, ) -> Self
Create a new platform error.
Sourcepub fn platform_with_code<S: Into<String>, P: Into<String>>(
code: ErrorCode,
message: S,
platform: P,
) -> Self
pub fn platform_with_code<S: Into<String>, P: Into<String>>( code: ErrorCode, message: S, platform: P, ) -> Self
Create a new platform error with specific code.
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Check if this error is retryable.
Sourcepub const fn is_timeout(&self) -> bool
pub const fn is_timeout(&self) -> bool
Check if this error is a timeout.
Sourcepub const fn is_config_error(&self) -> bool
pub const fn is_config_error(&self) -> bool
Check if this error is configuration-related.
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
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy
. Read more