miden_client/remote_prover/
mod.rs1use alloc::boxed::Box;
2use alloc::string::{String, ToString};
3use core::error::Error as CoreError;
4
5use thiserror::Error;
6
7mod api_client;
8mod generated;
9mod tx_prover;
10
11pub use tx_prover::RemoteTransactionProver;
12
13#[derive(Debug, Error)]
18pub enum RemoteProverClientError {
19 #[error("failed to connect to prover {0}")]
21 ConnectionFailed(#[source] Box<dyn CoreError + Send + Sync + 'static>),
22 #[error("{error_msg}")]
24 Other {
25 error_msg: Box<str>,
26 source: Option<Box<dyn CoreError + Send + Sync + 'static>>,
27 },
28}
29
30impl From<RemoteProverClientError> for String {
31 fn from(err: RemoteProverClientError) -> Self {
32 err.to_string()
33 }
34}
35
36impl RemoteProverClientError {
37 pub fn other(message: impl Into<String>) -> Self {
40 let message: String = message.into();
41 Self::Other { error_msg: message.into(), source: None }
42 }
43
44 pub fn other_with_source(
47 message: impl Into<String>,
48 source: impl CoreError + Send + Sync + 'static,
49 ) -> Self {
50 let message: String = message.into();
51 Self::Other {
52 error_msg: message.into(),
53 source: Some(Box::new(source)),
54 }
55 }
56}