Skip to main content

mycelix_leptos_client/
error.rs

1// Copyright (C) 2024-2026 Tristan Stoltz / Luminous Dynamics
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4//! Error types for the Holochain browser client.
5
6/// Errors that can occur during Holochain client operations.
7#[derive(Debug, thiserror::Error)]
8pub enum ClientError {
9    /// No active connection to the conductor.
10    #[error("Not connected to conductor")]
11    NotConnected,
12
13    /// WebSocket connection could not be established.
14    #[error("Connection failed: {0}")]
15    ConnectionFailed(String),
16
17    /// MessagePack serialization or deserialization failed.
18    #[error("Serialization error: {0}")]
19    SerializationError(String),
20
21    /// The conductor returned an error for the zome call.
22    #[error("Zome call failed: {0}")]
23    ZomeCallFailed(String),
24
25    /// The zome call did not complete within the timeout period.
26    #[error("Timeout after {0}ms")]
27    Timeout(u32),
28
29    /// A WebSocket-level error occurred.
30    #[error("WebSocket error: {0}")]
31    WebSocketError(String),
32
33    /// A response was received for an unknown request ID.
34    #[error("Unknown request ID: {0}")]
35    UnknownRequestId(u64),
36
37    /// The conductor sent a response that could not be parsed.
38    #[error("Invalid response: {0}")]
39    InvalidResponse(String),
40
41    /// Authentication with the conductor failed.
42    #[error("Authentication failed: {0}")]
43    AuthenticationFailed(String),
44
45    /// The requested role name was not found in the app info.
46    #[error("Unknown role: {0}")]
47    UnknownRole(String),
48}