Include recent Magic app work: Tauri native shell, iOS device detection via supervise-magic sidecar, MDM client, local HTTP server, new pages (detect, enroll, supervise, sideload, pair, preflight, configure, done), and updated device section/status UI.
44 lines
911 B
Rust
44 lines
911 B
Rust
use serde::{Deserialize, Serialize};
|
|
use std::fmt;
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct AppError {
|
|
pub message: String,
|
|
}
|
|
|
|
impl fmt::Display for AppError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "{}", self.message)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for AppError {}
|
|
|
|
impl AppError {
|
|
pub fn new(message: impl Into<String>) -> Self {
|
|
Self {
|
|
message: message.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<anyhow::Error> for AppError {
|
|
fn from(value: anyhow::Error) -> Self {
|
|
Self::new(value.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<std::io::Error> for AppError {
|
|
fn from(value: std::io::Error) -> Self {
|
|
Self::new(value.to_string())
|
|
}
|
|
}
|
|
|
|
impl From<serde_json::Error> for AppError {
|
|
fn from(value: serde_json::Error) -> Self {
|
|
Self::new(value.to_string())
|
|
}
|
|
}
|
|
|
|
pub type AppResult<T> = Result<T, AppError>;
|