wasmer_config/package/
error.rs

1/// Error that occurs during package ident/source parsing.
2#[derive(Clone, Debug, PartialEq, Eq)]
3pub struct PackageParseError {
4    value: String,
5    message: String,
6}
7
8impl PackageParseError {
9    pub(crate) fn new(value: impl Into<String>, message: impl Into<String>) -> Self {
10        Self {
11            value: value.into(),
12            message: message.into(),
13        }
14    }
15}
16
17impl std::fmt::Display for PackageParseError {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(
20            f,
21            "could not parse value as package identifier: {} (value: '{}')",
22            self.message, self.value
23        )
24    }
25}
26
27impl std::error::Error for PackageParseError {}