citum_engine/error.rs
1/*
2SPDX-License-Identifier: MIT OR Apache-2.0
3SPDX-FileCopyrightText: © 2023-2026 Bruce D'Arcus
4*/
5
6use thiserror::Error;
7
8/// Errors produced while resolving or rendering citations and bibliographies.
9#[derive(Error, Debug)]
10pub enum ProcessorError {
11 /// A citation referenced an item ID that is not present in the bibliography.
12 #[error("Reference not found: {0}")]
13 ReferenceNotFound(String),
14
15 /// Date parsing or normalization failed for a reference field.
16 #[error("Date parse error: {0}")]
17 DateParseError(String),
18
19 /// Locale data could not be loaded or did not contain a required term.
20 #[error("Locale error: {0}")]
21 LocaleError(String),
22
23 /// Contributor or title substitution logic failed.
24 #[error("Substitution error: {0}")]
25 SubstitutionError(String),
26
27 /// Reading an input file from disk failed.
28 #[error("File I/O error: {0}")]
29 FileIO(#[from] std::io::Error),
30
31 /// Parsing a named input failed with a message describing the problem.
32 #[error("Parse error ({0}): {1}")]
33 ParseError(String, String),
34}