field_lib

Cross-platform Rust runtime for Radroots iOS and Android apps
git clone https://radroots.dev/git/field_lib.git
Log | Files | Refs | README | LICENSE

error.rs (1244B)


      1 use thiserror::Error;
      2 
      3 #[derive(Debug, Error, uniffi::Error)]
      4 pub enum RadrootsAppError {
      5     #[error("initialization: {0}")]
      6     Initialization(String),
      7     #[error("identity: {0}")]
      8     Identity(String),
      9     #[error("secure store: {0}")]
     10     SecureStore(String),
     11     #[error("relay: {0}")]
     12     Relay(String),
     13     #[error("runtime: {0}")]
     14     Runtime(String),
     15     #[error("unsupported: {0}")]
     16     Unsupported(String),
     17     #[error("internal: {0}")]
     18     Internal(String),
     19 }
     20 
     21 impl RadrootsAppError {
     22     pub fn initialization(message: impl Into<String>) -> Self {
     23         Self::Initialization(message.into())
     24     }
     25 
     26     pub fn identity(message: impl Into<String>) -> Self {
     27         Self::Identity(message.into())
     28     }
     29 
     30     pub fn secure_store(message: impl Into<String>) -> Self {
     31         Self::SecureStore(message.into())
     32     }
     33 
     34     pub fn relay(message: impl Into<String>) -> Self {
     35         Self::Relay(message.into())
     36     }
     37 
     38     pub fn runtime(message: impl Into<String>) -> Self {
     39         Self::Runtime(message.into())
     40     }
     41 
     42     pub fn unsupported(message: impl Into<String>) -> Self {
     43         Self::Unsupported(message.into())
     44     }
     45 
     46     pub fn internal(message: impl Into<String>) -> Self {
     47         Self::Internal(message.into())
     48     }
     49 }