nostr_db/
error.rs

1#[derive(thiserror::Error, Debug)]
2pub enum Error {
3    #[error(transparent)]
4    Kv(#[from] nostr_kv::Error),
5    #[error(transparent)]
6    ConvertU64(#[from] std::array::TryFromSliceError),
7    #[error(transparent)]
8    Secp256k1(#[from] secp256k1::Error),
9    #[error(transparent)]
10    ParseIntError(#[from] std::num::ParseIntError),
11    #[error("json: {0}")]
12    Json(#[from] serde_json::Error),
13    #[error("io: {0}")]
14    Io(#[from] std::io::Error),
15    #[error("hex: {0}")]
16    Hex(#[from] hex::FromHexError),
17    #[error("deserialization: {0}")]
18    Deserialization(String),
19    #[error("serialization: {0}")]
20    Serialization(String),
21    #[error("invalid: {0}")]
22    Invalid(String),
23    #[error("invalid length")]
24    InvalidLength,
25    #[error("message: {0}")]
26    Message(String),
27    #[error("Scan timeout")]
28    ScanTimeout,
29    #[error("The database schema has been modified. Please run export first, move the old database file, then import and start the program.
30      Find the rnostr command at https://github.com/rnostr/rnostr#commands
31      rnostr export data/events > events.json
32      mv data/events data/old_events
33      rnostr import data/events events.json
34    ")]
35    VersionMismatch,
36}