soil_rpc/api/statement/
error.rs1use jsonrpsee::types::error::{ErrorObject, ErrorObjectOwned};
10
11pub type Result<T> = std::result::Result<T, Error>;
13
14#[derive(Debug, thiserror::Error)]
16pub enum Error {
17 #[error("Statement store error")]
19 StatementStore(String),
20 #[error(transparent)]
22 UnsafeRpcCalled(#[from] crate::api::policy::UnsafeRpcError),
23}
24
25const BASE_ERROR: i32 = crate::api::error::base::STATEMENT;
27
28impl From<Error> for ErrorObjectOwned {
29 fn from(e: Error) -> Self {
30 match e {
31 Error::StatementStore(message) => ErrorObject::owned(
32 BASE_ERROR + 1,
33 format!("Statement store error: {message}"),
34 None::<()>,
35 ),
36 Error::UnsafeRpcCalled(e) => e.into(),
37 }
38 }
39}