matchmaker_partial/
errors.rs1use std::fmt;
2use thiserror::Error;
3
4#[derive(Debug, PartialEq, Error)]
5pub enum SimpleError {
6 #[error("expected a single value")]
7 ExpectedSingle,
8
9 #[error("invalid type: expected {expected}, got `{found}`")]
10 InvalidType {
11 expected: &'static str,
12 found: String,
13 },
14
15 #[error("{0}")]
16 Custom(String),
17
18 #[error("Parse failure: {0}")]
19 ParseFailure(String),
20
21 #[error("trailing tokens starting at index {index}")]
22 TrailingTokens { index: usize },
23}
24
25impl serde::de::Error for SimpleError {
26 fn custom<T: fmt::Display>(msg: T) -> Self {
27 SimpleError::Custom(msg.to_string())
28 }
29}
30
31#[derive(Debug, PartialEq, thiserror::Error)]
32pub enum PartialSetError {
33 #[error("Unknown field: {0}")]
34 Missing(String),
35 #[error("Expected more paths after: {0}")]
36 EarlyEnd(String),
37 #[error("Unexpected paths after a concrete field: {0:?}")]
38 ExtraPaths(Vec<String>),
39 #[error(transparent)]
40 Deserialization(#[from] SimpleError),
41}