1use std::ffi::NulError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum RpcError {
9 #[error("Failed to initialize RPC backend for endpoint: {endpoint}")]
11 InitializationFailed {
12 endpoint: String,
14 },
15
16 #[error("Invalid endpoint format: {endpoint}")]
18 InvalidEndpoint {
19 endpoint: String,
21 },
22
23 #[error("Failed to connect to RPC server at {endpoint}: {reason}")]
25 ConnectionFailed {
26 endpoint: String,
28 reason: String,
30 },
31
32 #[error("RPC server error: {message}")]
34 ServerError {
35 message: String,
37 },
38
39 #[error("Failed to query device memory")]
41 MemoryQueryFailed,
42
43 #[error("Failed to convert C string: {0}")]
45 StringConversion(#[from] NulError),
46
47 #[error("Invalid UTF-8: {0}")]
49 Utf8Error(#[from] std::str::Utf8Error),
50
51 #[error("RPC feature not compiled in. Build with --features rpc")]
53 NotAvailable,
54}