Skip to main content

Module error

Module error 

Source
Expand description

Standardized error types for the NodeDB public API.

NodeDbError is a struct (not an enum) that separates:

  • code — stable numeric code for programmatic handling (NDB-1000)
  • message — human-readable explanation
  • details — machine-matchable ErrorDetails enum with structured data
  • cause — optional chained error for debugging

§Wire format

Serializes to:

{
  "code": "NDB-1000",
  "message": "constraint violation on users: duplicate email",
  "details": { "kind": "constraint_violation", "collection": "users" }
}

§Error code ranges

RangeCategory
1000–1099Write path
1100–1199Read path
1200–1299Query
2000–2099Auth/Security
3000–3099Sync
4000–4099Storage
4100–4199WAL
4200–4299Serialization
5000–5099Config
6000–6099Cluster
7000–7099Memory
8000–8099Encryption
9000–9099Internal

Re-exports§

pub use code::ErrorCode;
pub use details::ErrorDetails;
pub use types::NodeDbError;
pub use types::NodeDbResult;

Modules§

code
Stable numeric error codes for programmatic error handling.
ctors
NodeDbError constructors, split by category.
details
Machine-matchable structured error details.
types
NodeDbError struct + accessors + category predicates + From<io::Error>.