terraform_version/
error.rs1use crate::Operator;
2
3pub type Result<T, E = Error> = std::result::Result<T, E>;
4
5#[derive(Debug, thiserror::Error, miette::Diagnostic, PartialEq, Eq)]
6pub enum Error {
7 #[error("No version filled in")]
9 NoVersion,
10
11 #[error("No version requirement filled in")]
13 NoVersionRequirement,
14
15 #[error("Operator `{0}` forbidden. Non-empty suffix is only allowed if operator is Exact of Different")]
17 NotAllowedOperatorWithSuffix(Operator),
18
19 #[error("Invalid operator in comparator : `{0}`")]
21 InvalidOperator(String),
22
23 #[error("Impossible to parse version requirement `{0}`. Operator `Exact` is forbidden in multi comparator. Consider removing either the exact operator comparator, or all others.")]
25 NotAllowedOperatorWithMultipleComparators(String),
26
27 #[error("Impossible to parse numeric identifier `{text}` : `{ni}` is not a number")]
29 ImpossibleNumericIdentifierParsing {
30 #[source]
31 err: std::num::ParseIntError,
32 text: String,
33 ni: String,
34 },
35}