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