pub enum EnhancedError {
Config {
message: String,
suggestion: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
FileNotFound {
path: PathBuf,
suggestion: String,
},
Parse {
location: String,
message: String,
context: String,
},
Validation {
field: String,
message: String,
suggestion: String,
},
Io {
path: PathBuf,
message: String,
source: Error,
},
Template {
template: String,
message: String,
suggestion: String,
},
Sync {
editor: String,
message: String,
suggestion: String,
},
Security {
message: String,
action: String,
},
BinaryFormat {
message: String,
expected: String,
actual: String,
},
Hook {
hook_id: String,
message: String,
},
Protocol {
code: i32,
message: String,
},
}Expand description
Enhanced error type with actionable messages
Variants§
Config
Configuration error with suggestion
FileNotFound
File not found with path context
Parse
Parse error with location
Validation
Validation error with details
Io
IO error with path context
Template
Template error with template name
Sync
Sync error with editor context
Security
Security error
BinaryFormat
Binary format error
Hook
Hook error
Protocol
DCP protocol error
Implementations§
Source§impl EnhancedError
impl EnhancedError
Sourcepub fn config(message: impl Into<String>, suggestion: impl Into<String>) -> Self
pub fn config(message: impl Into<String>, suggestion: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn config_with_source(
message: impl Into<String>,
suggestion: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn config_with_source( message: impl Into<String>, suggestion: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> Self
Create a configuration error with source
Sourcepub fn file_not_found(
path: impl Into<PathBuf>,
suggestion: impl Into<String>,
) -> Self
pub fn file_not_found( path: impl Into<PathBuf>, suggestion: impl Into<String>, ) -> Self
Create a file not found error
Sourcepub fn parse(
location: impl Into<String>,
message: impl Into<String>,
context: impl Into<String>,
) -> Self
pub fn parse( location: impl Into<String>, message: impl Into<String>, context: impl Into<String>, ) -> Self
Create a parse error
Sourcepub fn validation(
field: impl Into<String>,
message: impl Into<String>,
suggestion: impl Into<String>,
) -> Self
pub fn validation( field: impl Into<String>, message: impl Into<String>, suggestion: impl Into<String>, ) -> Self
Create a validation error
Sourcepub fn template(
template: impl Into<String>,
message: impl Into<String>,
suggestion: impl Into<String>,
) -> Self
pub fn template( template: impl Into<String>, message: impl Into<String>, suggestion: impl Into<String>, ) -> Self
Create a template error
Sourcepub fn sync(
editor: impl Into<String>,
message: impl Into<String>,
suggestion: impl Into<String>,
) -> Self
pub fn sync( editor: impl Into<String>, message: impl Into<String>, suggestion: impl Into<String>, ) -> Self
Create a sync error
Sourcepub fn security(message: impl Into<String>, action: impl Into<String>) -> Self
pub fn security(message: impl Into<String>, action: impl Into<String>) -> Self
Create a security error
Sourcepub fn binary_format(
message: impl Into<String>,
expected: impl Into<String>,
actual: impl Into<String>,
) -> Self
pub fn binary_format( message: impl Into<String>, expected: impl Into<String>, actual: impl Into<String>, ) -> Self
Create a binary format error
Sourcepub fn hook(hook_id: impl Into<String>, message: impl Into<String>) -> Self
pub fn hook(hook_id: impl Into<String>, message: impl Into<String>) -> Self
Create a hook error
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Check if this is a recoverable error
Sourcepub fn error_code(&self) -> &'static str
pub fn error_code(&self) -> &'static str
Get the error code for this error type
Trait Implementations§
Source§impl Debug for EnhancedError
impl Debug for EnhancedError
Source§impl Display for EnhancedError
impl Display for EnhancedError
Source§impl Error for EnhancedError
impl Error for EnhancedError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for EnhancedError
impl !UnwindSafe for EnhancedError
impl Freeze for EnhancedError
impl Send for EnhancedError
impl Sync for EnhancedError
impl Unpin for EnhancedError
impl UnsafeUnpin for EnhancedError
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.