aws_arn/
error.rs

1/*!
2One-line description.
3
4More detailed description, with
5
6# Example
7
8*/
9
10use std::error::Error as StdError;
11use std::fmt::{Debug, Display, Formatter, Result};
12
13// ------------------------------------------------------------------------------------------------
14// Public Types
15// ------------------------------------------------------------------------------------------------
16
17///
18/// Errors that may arise parsing an ResourceName with `FromStr::from_str()`.
19///
20#[derive(Debug, PartialEq)]
21pub enum Error {
22    /// String length must be greater than 8 corresponding to `"arn:::::"`.
23    TooShort,
24    /// String length must be under 2048 characters..
25    TooLong,
26    /// Need at least 6 components.
27    TooFewComponents,
28    /// Invalid `Identifier` string value.
29    InvalidIdentifier(String),
30    /// Missing the 'arn' prefix string.
31    MissingPrefix,
32    /// Missing the partition component.
33    MissingPartition,
34    /// The partition component provided is not valid.
35    InvalidPartition,
36    /// Missing the service component.
37    MissingService,
38    /// The service component provided is not valid.
39    InvalidService,
40    /// Missing the region component.
41    MissingRegion,
42    /// The partition region provided is not valid.
43    InvalidRegion,
44    /// The particular resource type does not allow region wildcards.
45    RegionWildcardNotAllowed,
46    /// Missing the account id component.
47    MissingAccountId,
48    /// The partition account id provided is not valid.
49    InvalidAccountId(String),
50    /// The particular resource type does not allow account wildcards.
51    AccountIdWildcardNotAllowed,
52    /// Missing the resource component.
53    MissingResource,
54    /// The partition resource provided is not valid, the name of the particular component
55    /// in error is included.
56    InvalidResource(String),
57    /// The particular resource type does not allow resource wildcards.
58    ResourceWildcardNotAllowed,
59}
60
61// ------------------------------------------------------------------------------------------------
62// Implementations
63// ------------------------------------------------------------------------------------------------
64
65impl Display for Error {
66    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
67        write!(f, "{:?}", self)
68    }
69}
70
71impl StdError for Error {}