use jsonrpsee::types::error::{ErrorObject, ErrorObjectOwned};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Statement store error")]
StatementStore(String),
#[error(transparent)]
UnsafeRpcCalled(#[from] crate::policy::UnsafeRpcError),
}
const BASE_ERROR: i32 = crate::error::base::STATEMENT;
impl From<Error> for ErrorObjectOwned {
fn from(e: Error) -> Self {
match e {
Error::StatementStore(message) => ErrorObject::owned(
BASE_ERROR + 1,
format!("Statement store error: {message}"),
None::<()>,
),
Error::UnsafeRpcCalled(e) => e.into(),
}
}
}