Skip to main content

Module errors

Module errors 

Source
Expand description

Typed persistence errors.

Most public APIs in this crate return anyhow::Result for ergonomic error chaining. This module exposes a small thiserror enum with the variants callers most often need to distinguish (e.g. “operation not supported” vs “operation failed”). Producers wrap the enum in anyhow::Error and consumers downcast:

use nautilus_persistence::errors::PersistenceError;

if matches!(
    err.downcast_ref::<PersistenceError>(),
    Some(PersistenceError::Unsupported(_))
) {
    // The concrete backend does not support the requested operation.
}

Migrating individual functions to return Result<T, PersistenceError> directly is a follow-up; the downcast pattern lets new variants ship without breaking existing anyhow::Result signatures.

Enums§

PersistenceError
Typed errors that callers may want to programmatically distinguish.