Skip to main content

Crate jetstream_error

Crate jetstream_error 

Source
Expand description

Error handling for Jetstream

r[impl jetstream.error.v2.type] r[impl jetstream.error.v2.source-info.disable] jetstream::Error is a struct containing a Box<ErrorInner> (message, code, help, url), an optional SpanTrace captured at creation, and lazily-initialized Backtrace and diagnostics state. The design is modeled after TracedError from the tracing-error crate. The Box indirection on ErrorInner keeps Error efficient for passing through Result.

$ # do some rpc server::validation::E001   × [server::validation::E001] Server-side validation failed Error:    × validate_request    ╭─[components/jetstream_error/src/tests.rs:3:4]  2 │ #[tracing::instrument]  3 │ fn validate_request(user_id: u64, email: &str) -> super::Error {    ·    ────────┬───────    ·            ╰── validate_request(user_id: 42, email: "user@example.com")  4 │     super::Error::with_code(    ╰──── Error:    × handle_request     ╭─[components/jetstream_error/src/tests.rs:12:4]  11 │ #[tracing::instrument]  12 │ fn handle_request(endpoint: &str) -> super::Error {     ·    ───────┬──────     ·           ╰── handle_request(endpoint: "/api/v1/submit")  13 │     validate_request(42, "user@example.com")     ╰──── Error:    × make_error     ╭─[components/jetstream_error/src/tests.rs:18:4]  17 │ #[tracing::instrument]  18 │ fn make_error() -> super::Error {     ·    ─────┬────     ·         ╰── make_error()  19 │     handle_request("/api/v1/submit")     ╰────

Modules§

coding
Structured span trace types for wire format serialization.

Structs§

Error
Error is the main error type for Jetstream

Traits§

IntoError
IntoError trait allows conversion of various error types into Jetstream Error.

Type Aliases§

Result
Result is a type alias for a Result type that uses the Error type.