Skip to main content

CoreError

Trait CoreError 

pub(crate) trait CoreError: Display {
    // Required method
    fn raise(&self, message: String) -> PyErr;

    // Provided methods
    fn is_caller_input(&self) -> bool { ... }
    fn cause(&self) -> Option<&(dyn Error + 'static)> { ... }
}
Expand description

A core error that knows which exception it raises as.

The mapping is by type, then by the core’s own classifiers, so the compiler — not a string match — decides the exception class: a new core error type is a compile error here until it is placed, and a new variant is a compile error in the core’s exhaustive classifier (missing_input, is_unsolved, is_unconverged, lacks_ladder) until it is classified. The message is the core’s own rendering: a typed core error already names the curve, the date or the key it is about, and restating it here would give the Python user a worse message than the Rust one.

Required Methods§

fn raise(&self, message: String) -> PyErr

This refusal’s exception, carrying message.

Provided Methods§

fn is_caller_input(&self) -> bool

Whether this failure is the caller’s input rather than the layer’s own — raised as ValueError whatever the layer, with the core’s text.

fn cause(&self) -> Option<&(dyn Error + 'static)>

The core error this one wraps, if it wraps one: raised as the Python exception’s __cause__, so a caller reaches the failure that caused the one it caught, as Rust’s source() does.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl CoreError for BondFutureError

§

fn raise(&self, message: String) -> PyErr

§

fn cause(&self) -> Option<&(dyn Error + 'static)>

§

fn is_caller_input(&self) -> bool

§

impl CoreError for BondReadingError

§

fn raise(&self, message: String) -> PyErr

§

fn is_caller_input(&self) -> bool

§

fn cause(&self) -> Option<&(dyn Error + 'static)>

§

impl CoreError for CalibrationError

§

fn raise(&self, message: String) -> PyErr

§

fn cause(&self) -> Option<&(dyn Error + 'static)>

§

impl CoreError for CallYieldError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for CapFloorError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for CmsSwapError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for CurveError

§

fn raise(&self, message: String) -> PyErr

§

fn is_caller_input(&self) -> bool

§

impl CoreError for FitError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for LinkerQuoteError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for MarketDataError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for NoSingleBasis

§

fn raise(&self, message: String) -> PyErr

§

fn is_caller_input(&self) -> bool

§

impl CoreError for PricingError

§

fn raise(&self, message: String) -> PyErr

§

fn cause(&self) -> Option<&(dyn Error + 'static)>

§

impl CoreError for RateFutureError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for RiskError

§

fn raise(&self, message: String) -> PyErr

§

fn cause(&self) -> Option<&(dyn Error + 'static)>

§

impl CoreError for SpreadSolveError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for StubInterpolationError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for SwapIndexError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for SwapLegsError

§

fn raise(&self, message: String) -> PyErr

§

impl CoreError for YieldSolveError

§

fn raise(&self, message: String) -> PyErr

Implementors§