buildkit_rs_reference/
error.rs

1use thiserror::Error;
2
3use crate::consts::NAME_TOTAL_LENGTH_MAX;
4
5/// The error type for parsing a reference
6#[derive(Debug, Clone, Error)]
7pub enum Error {
8    /// The reference is not valid, this is the most generic error
9    #[error("invalid reference format")]
10    InvalidReferenceFormat,
11
12    /// The repository name is not valid as it contains uppercase characters
13    #[error("repository name must be lowercase")]
14    NameContainsUppercase,
15
16    /// The name is empty
17    #[error("repository name must have at least one component")]
18    NameEmpty,
19
20    /// The name is too long
21    #[error("repository name must not be more than {NAME_TOTAL_LENGTH_MAX} characters")]
22    NameTooLong,
23
24    /// The name matches the identifier pattern and is therefore not allowed
25    #[error("invalid repository name, cannot specify 64-byte hexadecimal strings")]
26    NameIdentifier,
27}