Rust

failure

Module

Errors recorded on spans.

Contents

use utopia_span::Failure;
Rust
pub struct Failure

An error recorded on a span: what exporters report about it.

It carries what exporters print: the error's type (class), message, code, where it was raised, its stack trace and the error that caused it. Failure::new records the caller's location; Failure::from_error converts any std::error::Error with its chain of sources.

Rust
use utopia_span::Failure;

let root = Failure::new("LogicException", "root cause");
let error = Failure::new("RuntimeException", "outer").code(42).previous(root);

assert_eq!(error.class(), "RuntimeException");
assert_eq!(error.code_value(), 42);
assert_eq!(error.cause().map(|c| c.message()), Some("root cause"));
Also implements Display, Error.
use utopia_span::Frame;
Rust
pub struct Frame

One call in a Failure's stack trace, innermost first.