lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

error.rs (557B)


      1 use core::fmt;
      2 
      3 #[cfg(not(feature = "std"))]
      4 use alloc::string::String;
      5 
      6 #[derive(Debug)]
      7 pub enum ProfileEncodeError {
      8     InvalidUrl(&'static str, String),
      9     Json,
     10 }
     11 
     12 impl fmt::Display for ProfileEncodeError {
     13     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     14         match self {
     15             Self::InvalidUrl(field, val) => write!(f, "invalid URL for {}: {}", field, val),
     16             Self::Json => write!(f, "failed to serialize metadata JSON"),
     17         }
     18     }
     19 }
     20 
     21 #[cfg(feature = "std")]
     22 impl std::error::Error for ProfileEncodeError {}