Add Proxmox Backup Server datastore management: overview, datastore detail, download/prune/verify/GC dialogs, usePbs hook, backend commands, and tests. Fix macOS keychain re-writes failing with 'item already exists': replace keyring 3 with keyring-core plus per-platform stores (macOS Keychain, Windows Credential Manager, Linux keyutils), recover by deleting the stale item and retrying once, and surface actionable messages for locked keychains.
57 lines
1.2 KiB
Rust
57 lines
1.2 KiB
Rust
use serde::{Serialize, Serializer};
|
|
use thiserror::Error;
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum Error {
|
|
#[error("Connection not found: {0}")]
|
|
ConnectionNotFound(String),
|
|
|
|
#[error("Not connected to server")]
|
|
NotConnected,
|
|
|
|
#[error("HTTP request failed: {0}")]
|
|
HttpError(#[from] reqwest::Error),
|
|
|
|
#[error("Cannot connect to server: {0}")]
|
|
ConnectionFailed(String),
|
|
|
|
#[error("Certificate error: {0}")]
|
|
CertificateError(String),
|
|
|
|
#[error("Invalid credentials: {0}")]
|
|
InvalidCredentials(String),
|
|
|
|
#[error("Authentication failed: {0}")]
|
|
AuthError(String),
|
|
|
|
#[error("Keyring error: {0}")]
|
|
KeyringError(String),
|
|
|
|
#[error("Serialization error: {0}")]
|
|
SerializationError(String),
|
|
|
|
#[error("Invalid URL: {0}")]
|
|
InvalidUrl(String),
|
|
|
|
#[error("API error: {0}")]
|
|
ApiError(String),
|
|
|
|
#[error("WebSocket error: {0}")]
|
|
WebSocketError(String),
|
|
|
|
#[error("Tauri error: {0}")]
|
|
TauriError(#[from] tauri::Error),
|
|
|
|
#[error("I/O error: {0}")]
|
|
IoError(#[from] std::io::Error),
|
|
}
|
|
|
|
impl Serialize for Error {
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
where
|
|
S: Serializer,
|
|
{
|
|
serializer.serialize_str(self.to_string().as_ref())
|
|
}
|
|
}
|