Skip to main content

Module error

Module error 

Source
Expand description

Workspace-wide typed errors.

Per-module errors (CodecError, StoreError) stay local to the modules that raise them — they describe failures a single subsystem can own. Error is the umbrella type for functions that touch more than one subsystem (e.g. a sign-in handler that loads a user and mints a token); it carries the original typed cause via #[from] so callers can downcast when they need to.

All the error types live here in cheers-core, even when the machinery that raises them lives in a higher crate: RefreshError is produced by cheers-server’s refresh rotator, but the type is keyless, so keeping it in the shared contract crate lets the Error umbrella stay whole (both the cheers-verify EdgeVerifier and the cheers-server SessionAuthority return this one Error).

use cheers_core::{CodecError, Error};

fn outer() -> Result<(), Error> {
    // CodecError -> Error via the From impl.
    Err(CodecError::Malformed)?
}

assert!(matches!(outer(), Err(Error::Codec(CodecError::Malformed))));

Enums§

Error
Top-level cheers error. #[non_exhaustive] so new variants are non-breaking.
RefreshError
Errors raised by refresh-token rotation (cheers-server’s RefreshRotator).

Type Aliases§

Result
Crate-local Result alias. Re-exported at the crate root.