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

Structs§

ErrorCode
Stable numeric error codes for programmatic error handling.
NodeDbError
Public error type returned by all NodeDb trait methods.

Enums§

ErrorDetails
Structured error details for programmatic matching.

Type Aliases§

NodeDbResult
Result alias for NodeDb operations.