aranya_policy_text/
error.rs1use core::num::NonZeroUsize;
2
3#[derive(Clone, Debug, thiserror::Error)]
5#[error(transparent)]
6pub struct InvalidText(pub(crate) InvalidTextRepr);
7
8#[derive(Clone, Debug, thiserror::Error)]
9pub(crate) enum InvalidTextRepr {
10 #[error("text contained nul byte at index {index}")]
12 ContainsNul {
13 index: usize,
15 },
16}
17
18#[derive(Clone, Debug, thiserror::Error)]
20#[error(transparent)]
21pub struct InvalidIdentifier(pub(crate) InvalidIdentifierRepr);
22
23#[derive(Clone, Debug, thiserror::Error)]
24pub(crate) enum InvalidIdentifierRepr {
25 #[error("identifier must not be empty")]
27 NotEmpty,
28 #[error("identifier must start with alphabetic character")]
30 InitialNotAlphabetic,
31 #[error("identifier contained invalid character at index {index}")]
33 TrailingNotValid {
34 index: NonZeroUsize,
36 },
37}