miden_remote_prover_client/
lib.rs1#![no_std]
2#![allow(unused_imports)]
6#[macro_use]
7extern crate alloc;
8
9use alloc::boxed::Box;
10use alloc::string::{String, ToString};
11use core::error::Error as CoreError;
12
13#[cfg(feature = "std")]
14extern crate std;
15
16use thiserror::Error;
17
18pub mod remote_prover;
19
20#[derive(Debug, Error)]
24pub enum RemoteProverClientError {
25 #[error("invalid uri {0}")]
27 InvalidEndpoint(String),
28 #[error("failed to connect to prover {0}")]
29 ConnectionFailed(#[source] Box<dyn CoreError + Send + Sync + 'static>),
31 #[error("{error_msg}")]
33 Other {
34 error_msg: Box<str>,
35 source: Option<Box<dyn CoreError + Send + Sync + 'static>>,
38 },
39}
40
41impl From<RemoteProverClientError> for String {
42 fn from(err: RemoteProverClientError) -> Self {
43 err.to_string()
44 }
45}
46
47impl RemoteProverClientError {
48 pub fn other(message: impl Into<String>) -> Self {
51 let message: String = message.into();
52 Self::Other { error_msg: message.into(), source: None }
53 }
54
55 pub fn other_with_source(
58 message: impl Into<String>,
59 source: impl CoreError + Send + Sync + 'static,
60 ) -> Self {
61 let message: String = message.into();
62 Self::Other {
63 error_msg: message.into(),
64 source: Some(Box::new(source)),
65 }
66 }
67}