#[repr(u8)]pub enum ErrorCategory {
Internal = 1,
Usage = 2,
NotFound = 3,
InvalidQuery = 4,
Network = 5,
Timeout = 6,
Integrity = 7,
}Expand description
Semantic error category determining the exit code.
Each category maps to a specific exit code for reliable error handling in shell scripts and CI pipelines.
Variants§
Internal = 1
Unexpected or internal error (exit code 1).
Use for programming errors, assertion failures, or errors that shouldn’t happen in normal operation.
Usage = 2
Invalid arguments or configuration (exit code 2).
Use for CLI argument validation failures, invalid flag combinations, or configuration file errors.
NotFound = 3
Requested resource not found (exit code 3).
Use when a source alias, file, or other named resource doesn’t exist.
InvalidQuery = 4
Query syntax or semantic error (exit code 4).
Use for malformed search queries or invalid query parameters.
Network = 5
Network or fetch failure (exit code 5).
Use for HTTP errors, DNS failures, or connection timeouts when fetching remote content.
Timeout = 6
Operation timed out (exit code 6).
Use when an operation exceeds its time limit.
Integrity = 7
Index or data corruption (exit code 7).
Use when local data is corrupted, inconsistent, or unreadable.
Implementations§
Source§impl ErrorCategory
impl ErrorCategory
Sourcepub fn as_exit_code(self) -> ExitCode
pub fn as_exit_code(self) -> ExitCode
Create an ExitCode from this category.
Sourcepub const fn description(self) -> &'static str
pub const fn description(self) -> &'static str
Get a short description of this error category.
Sourcepub fn infer_from_message(msg: &str) -> Self
pub fn infer_from_message(msg: &str) -> Self
Infer the error category from an error message.
This provides a heuristic-based fallback when errors aren’t explicitly categorized. It examines the error message for common patterns.
Trait Implementations§
Source§impl Clone for ErrorCategory
impl Clone for ErrorCategory
Source§fn clone(&self) -> ErrorCategory
fn clone(&self) -> ErrorCategory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorCategory
impl Debug for ErrorCategory
Source§impl Display for ErrorCategory
impl Display for ErrorCategory
Source§impl Hash for ErrorCategory
impl Hash for ErrorCategory
Source§impl PartialEq for ErrorCategory
impl PartialEq for ErrorCategory
impl Copy for ErrorCategory
impl Eq for ErrorCategory
impl StructuralPartialEq for ErrorCategory
Auto Trait Implementations§
impl Freeze for ErrorCategory
impl RefUnwindSafe for ErrorCategory
impl Send for ErrorCategory
impl Sync for ErrorCategory
impl Unpin for ErrorCategory
impl UnwindSafe for ErrorCategory
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.