Files
notedeck/crates/enostr/src/error.rs
William Casarin 26b58683b8 feat: integrate nostrdb relay indexing
- Upgrade `nostrdb` to v0.6.1 with relay metadata support
- Switch to `nostr::RelayUrl` for typed relay URLs
- Use `process_event_with()` to pass relay info during ingestion
- Update `Relay`, `RelayPool`, and unknown ID logic accordingly

This enables richer indexing with relay provenance in events.

Signed-off-by: William Casarin <jb55@jb55.com>
2025-03-21 16:20:37 -07:00

62 lines
1.2 KiB
Rust

//use nostr::prelude::secp256k1;
use std::array::TryFromSliceError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("message is empty")]
Empty,
#[error("decoding failed: {0}")]
DecodeFailed(String),
#[error("hex decoding failed")]
HexDecodeFailed,
#[error("invalid bech32")]
InvalidBech32,
#[error("invalid byte size")]
InvalidByteSize,
#[error("invalid signature")]
InvalidSignature,
#[error("invalid public key")]
InvalidPublicKey,
#[error("invalid relay url")]
InvalidRelayUrl,
// Secp(secp256k1::Error),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("nostrdb error: {0}")]
Nostrdb(#[from] nostrdb::Error),
#[error("{0}")]
Generic(String),
}
impl From<String> for Error {
fn from(s: String) -> Self {
Error::Generic(s)
}
}
impl From<TryFromSliceError> for Error {
fn from(_e: TryFromSliceError) -> Self {
Error::InvalidByteSize
}
}
impl From<hex::FromHexError> for Error {
fn from(_e: hex::FromHexError) -> Self {
Error::HexDecodeFailed
}
}