Trait RucError

Source
pub trait RucError:
    Display
    + Debug
    + Send {
Show 17 methods // Required methods fn type_id(&self) -> TypeId; fn get_top_msg(&self) -> String; fn get_lowest_msg(&self) -> String; fn get_lowest_err(&self) -> &dyn RucError; fn get_top_msg_with_dbginfo(&self) -> String; // Provided methods fn type_ids(&self) -> Vec<TypeId> { ... } fn lowest_type_id(&self) -> TypeId { ... } fn lowest_is_type(&self, e: &dyn Any) -> bool { ... } fn contains_type(&self, e: &dyn Any) -> bool { ... } fn msg_eq(&self, another: &dyn RucError) -> bool { ... } fn msg_has_overloop(&self, another: &dyn RucError) -> bool { ... } fn cause(&self) -> Option<&dyn RucError> { ... } fn stringify_chain(&self, prefix: Option<&str>) -> String { ... } fn print_die(&self) -> ! { ... } fn generate_log(&self, prefix: Option<&str>) -> String { ... } fn generate_log_custom(&self, prefix: Option<&str>) -> String { ... } fn print(&self, prefix: Option<&str>) { ... }
}
Expand description

the major trait defination

Required Methods§

Source

fn type_id(&self) -> TypeId

type id of current error type

Source

fn get_top_msg(&self) -> String

convert the error of current level to string

Source

fn get_lowest_msg(&self) -> String

convert the error of lowest level to string

Source

fn get_lowest_err(&self) -> &dyn RucError

Get the original error object, used to match its original type by Any.

Source

fn get_top_msg_with_dbginfo(&self) -> String

“error msg” + “debug info”

Provided Methods§

Source

fn type_ids(&self) -> Vec<TypeId>

type ids of errors of each level(from top to bottom).

Source

fn lowest_type_id(&self) -> TypeId

get the type of the lowest(bottom) error

Source

fn lowest_is_type(&self, e: &dyn Any) -> bool

check the type of the lowest error

Source

fn contains_type(&self, e: &dyn Any) -> bool

check if an error exists in the error chain

Source

fn msg_eq(&self, another: &dyn RucError) -> bool

compare two object

Source

fn msg_has_overloop(&self, another: &dyn RucError) -> bool

check if any node from the error_chain matches the given error

Source

fn cause(&self) -> Option<&dyn RucError>

point to a error which caused current error

Source

fn stringify_chain(&self, prefix: Option<&str>) -> String

generate the final error msg

Source

fn print_die(&self) -> !

Panic after printing error_chain

Source

fn generate_log(&self, prefix: Option<&str>) -> String

Generate the log string

Source

fn generate_log_custom(&self, prefix: Option<&str>) -> String

Generate the log string with custom mode

Source

fn print(&self, prefix: Option<&str>)

Print log

Trait Implementations§

Source§

impl<E: Debug + Display + Send + 'static> From<SimpleError<E>> for Box<dyn RucError>

Source§

fn from(e: SimpleError<E>) -> Box<dyn RucError>

Converts to this type from the input type.
Source§

impl<E: Debug + Display + Send + 'static> From<SimpleMsg<E>> for Box<dyn RucError>

Source§

fn from(m: SimpleMsg<E>) -> Self

Converts to this type from the input type.

Implementors§

Source§

impl<E: Debug + Display + Send + 'static> RucError for SimpleError<E>