linkmarks_core/errors.rs
1//! Error types for `linkmarks-core`.
2
3use thiserror::Error;
4
5/// Top-level error type for core operations.
6#[derive(Debug, Error)]
7pub enum CoreError {
8 /// A bookmark URL could not be parsed.
9 #[error("invalid url: {0}")]
10 InvalidUrl(String),
11
12 /// A canonicalization rule failed (e.g., IDN with non-ASCII host).
13 #[error("canonicalize failed: {0}")]
14 Canonicalize(String),
15
16 /// I/O error from the underlying reader/writer.
17 #[error("io: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// SQLite storage error.
21 #[error("storage error: {0}")]
22 Storage(String),
23
24 /// JSON parsing error.
25 #[error("json: {0}")]
26 Json(#[from] serde_json::Error),
27
28 /// A bridge or sink reported a non-fatal element failure. The
29 /// `element` field carries the affected input identifier (URL or
30 /// external_id) for reporting.
31 #[error("partial failure at element {element}: {reason}")]
32 Partial {
33 /// Identifier of the offending element (URL, external_id, etc).
34 element: String,
35 /// Human-readable reason.
36 reason: String,
37 },
38}