wasmer_config/package/
error.rs

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
/// Error that occurs during package ident/source parsing.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PackageParseError {
    value: String,
    message: String,
}

impl PackageParseError {
    pub(crate) fn new(value: impl Into<String>, message: impl Into<String>) -> Self {
        Self {
            value: value.into(),
            message: message.into(),
        }
    }
}

impl std::fmt::Display for PackageParseError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "could not parse value as package identifier: {} (value: '{}')",
            self.message, self.value
        )
    }
}

impl std::error::Error for PackageParseError {}