pub struct CoreError { /* private fields */ }Expand description
An FFI-independent error shared by all Litsea language bindings.
Carries a ErrorKind category plus a human-readable message. It is
Clone (unlike LitseaError, which wraps std::io::Error) because
bindings frequently need to store or re-raise an error after the
original has been consumed.
Implementations§
Source§impl CoreError
impl CoreError
Sourcepub fn invalid_argument(message: impl Into<String>) -> Self
pub fn invalid_argument(message: impl Into<String>) -> Self
Creates an ErrorKind::InvalidArgument error.
§Arguments
message- The human-readable message.
§Returns
The new CoreError.
Sourcepub fn model(message: impl Into<String>) -> Self
pub fn model(message: impl Into<String>) -> Self
Creates an ErrorKind::Model error.
§Arguments
message- The human-readable message.
§Returns
The new CoreError.
Sourcepub fn runtime(message: impl Into<String>) -> Self
pub fn runtime(message: impl Into<String>) -> Self
Creates an ErrorKind::Runtime error.
§Arguments
message- The human-readable message.
§Returns
The new CoreError.
Trait Implementations§
impl Eq for CoreError
Source§impl Error for CoreError
impl Error for CoreError
1.30.0 · 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
use the Display impl or to_string()
Source§impl From<LitseaError> for CoreError
impl From<LitseaError> for CoreError
Source§fn from(error: LitseaError) -> Self
fn from(error: LitseaError) -> Self
Maps a LitseaError onto a CoreError.
LitseaError::PosLearnerNotSet is rewritten: its message names the
Rust constructor with_two_stage_learner(), which means nothing to a
Python or Ruby caller, so the binding-facing message points at the
model file instead.
§Arguments
error- The error to convert.
§Returns
The equivalent CoreError.