1#[cfg(not(feature = "std"))]
2use alloc::string::String;
3#[cfg(not(feature = "std"))]
4use alloc::vec::Vec;
5
6use thiserror::Error;
7
8#[derive(Debug, Error, PartialEq)]
9pub enum ProsaicError {
10 #[error("missing slot `{slot}` in template `{template}`")]
11 MissingSlot { template: String, slot: String },
12
13 #[error("unknown template `{0}`")]
14 UnknownTemplate(String),
15
16 #[error("invalid pipe `{pipe}`: {reason}")]
17 InvalidPipe { pipe: String, reason: String },
18
19 #[error("grammar error: {0}")]
20 GrammarError(String),
21
22 #[error("template parse error in `{template}` at position {position}: {reason}")]
23 TemplateParseError {
24 template: String,
25 position: usize,
26 reason: String,
27 },
28
29 #[error("faithfulness rejected: precision {precision:.3}, polarity_match {polarity_match}")]
33 FaithfulnessRejection {
34 precision: f32,
35 polarity_match: bool,
36 },
37
38 #[error("recursive partial cycle detected: {}", cycle.join(" -> "))]
44 RecursivePartial { cycle: Vec<String> },
45}