mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Simplify runtime api error handling (#8114)
* Ahh * Work work work * Fix all the compilation errors * Fix test * More fixes...
This commit is contained in:
@@ -114,8 +114,8 @@ pub enum Error {
|
||||
#[error("Error decoding call result of {0}")]
|
||||
CallResultDecode(&'static str, #[source] CodecError),
|
||||
|
||||
#[error(transparent)]
|
||||
RuntimeApiCodecError(#[from] ApiError),
|
||||
#[error("Error at calling runtime api: {0}")]
|
||||
RuntimeApiError(#[from] ApiError),
|
||||
|
||||
#[error("Runtime :code missing in storage")]
|
||||
RuntimeCodeMissing,
|
||||
@@ -153,7 +153,6 @@ pub enum Error {
|
||||
#[error("Failed to get header for hash {0}")]
|
||||
MissingHeader(String),
|
||||
|
||||
|
||||
#[error("State Database error: {0}")]
|
||||
StateDatabase(String),
|
||||
|
||||
@@ -183,6 +182,15 @@ impl From<Box<dyn sp_state_machine::Error>> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Error> for ApiError {
|
||||
fn from(err: Error) -> ApiError {
|
||||
match err {
|
||||
Error::RuntimeApiError(err) => err,
|
||||
e => ApiError::Application(Box::new(e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error {
|
||||
/// Chain a blockchain error.
|
||||
pub fn from_blockchain(e: Box<Error>) -> Self {
|
||||
|
||||
Reference in New Issue
Block a user