ixa/
error.rs

1//! Provides [`IxaError`] and wraps other errors.
2use std::io;
3
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7#[allow(clippy::module_name_repetitions)]
8/// Provides [`IxaError`] and maps to other errors to
9/// convert to an [`IxaError`]
10pub enum IxaError {
11    #[error(transparent)]
12    IoError(#[from] io::Error),
13    #[error(transparent)]
14    JsonError(#[from] serde_json::Error),
15    #[error(transparent)]
16    CsvError(#[from] csv::Error),
17    #[error(transparent)]
18    Utf8Error(#[from] std::string::FromUtf8Error),
19    #[error(transparent)]
20    ParseIntError(#[from] std::num::ParseIntError),
21
22    #[error("duplicate property {name}")]
23    DuplicateProperty { name: String },
24    #[error("entry already exists")]
25    EntryAlreadyExists,
26    #[error("no global property: {name}")]
27    NoGlobalProperty { name: String },
28    #[error("property {name} is not set")]
29    PropertyNotSet { name: String },
30
31    #[error("illegal value for `{field}`: {value}")]
32    IllegalGlobalPropertyValue { field: String, value: String },
33
34    #[error(
35        "the same property appears in both position {first_index} and {second_index} in the property list"
36    )]
37    DuplicatePropertyInPropertyList {
38        first_index: usize,
39        second_index: usize,
40    },
41
42    #[error("breakpoint time {time} is in the past")]
43    BreakpointTimeInPast { time: f64 },
44    #[error("attempted to delete a nonexistent breakpoint {id}")]
45    BreakpointNotFound { id: u32 },
46
47    #[error("invalid key in pair: {pair}")]
48    InvalidLogLevelKey { pair: String },
49    #[error("invalid value in pair: {pair}")]
50    InvalidLogLevelValue { pair: String },
51    #[error("invalid log level: {level}")]
52    InvalidLogLevel { level: String },
53
54    #[error("invalid log level format: {log_level}")]
55    InvalidLogLevelFormat { log_level: String },
56
57    #[error("cannot make edge to self")]
58    CannotMakeEdgeToSelf,
59    #[error("invalid weight")]
60    InvalidWeight,
61    #[error("edge already exists")]
62    EdgeAlreadyExists,
63    #[error("can't sample from empty list")]
64    CannotSampleFromEmptyList,
65
66    #[error("initialization list is missing required properties")]
67    MissingRequiredInitializationProperties,
68}