Trait ruc::err::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>