pub enum Error {
Show 18 variants
InvalidInteger {
kind: IntErrorKind,
},
InvalidVariant(ParseError),
InvalidEmail(Error),
InvalidUrl(ParseError),
InvalidLicense(ParseError),
InvalidSemver {
kind: String,
},
ValueContainsInvalidChars {
invalid_char: char,
},
IncorrectLength {
length: usize,
expected: usize,
},
DelimiterNotFound {
delimiter: char,
},
ValueDoesNotMatchRestrictions {
restrictions: Vec<String>,
},
RegexDoesNotMatch {
value: String,
regex_type: String,
regex: String,
},
MissingComponent {
component: &'static str,
},
PathNotAbsolute(PathBuf),
PathNotRelative(PathBuf),
FileNameContainsInvalidChars(PathBuf, char),
FileNameIsEmpty,
DeprecatedLicense(String),
InvalidOpenPGPv4Fingerprint,
}
Expand description
The library’s error type
These errors are usually parsing errors and they each contain a context about why the error has occurred and the value that caused the error.
The original error is also included in the variants that have the source
field.
You can access it using the source()
method.
See Error::source for
more information.
Variants§
InvalidInteger
An invalid integer
Fields
kind: IntErrorKind
InvalidVariant(ParseError)
An invalid enum variant
InvalidEmail(Error)
An invalid email address
InvalidUrl(ParseError)
An invalid URL
InvalidLicense(ParseError)
An invalid license
InvalidSemver
An invalid semantic version string
This error occurs when a semantic version cannot be parsed from a string
We cannot use #[source] semver::Error
here because it does not implement PartialEq
.
See: https://github.com/dtolnay/semver/issues/326
TODO: Use the error source when the issue above is resolved.
ValueContainsInvalidChars
Value contains invalid characters
IncorrectLength
Value length is incorrect
DelimiterNotFound
Value is missing a delimiter character
ValueDoesNotMatchRestrictions
Value does not match the restrictions
RegexDoesNotMatch
A validation regex does not match the value
MissingComponent
Missing field in a value
PathNotAbsolute(PathBuf)
An invalid absolute path (i.e. does not start with a /
)
PathNotRelative(PathBuf)
An invalid relative path (i.e. starts with a /
)
FileNameContainsInvalidChars(PathBuf, char)
File name contains invalid characters
FileNameIsEmpty
File name is empty
DeprecatedLicense(String)
A deprecated license
InvalidOpenPGPv4Fingerprint
An invalid OpenPGP v4 fingerprint