mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 03:08:06 +00:00
use thiserror instead of derive_more for error handling (#10696)
* use thiserror instead of derive_more for error handling Signed-off-by: koushiro <koushiro.cqx@gmail.com> * Update utils/prometheus/src/lib.rs * Update utils/prometheus/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -284,20 +284,20 @@ impl<B: Block> LightClientRequestHandler<B> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(derive_more::Display, derive_more::From)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
enum HandleRequestError {
|
||||
#[display(fmt = "Failed to decode request: {}.", _0)]
|
||||
DecodeProto(prost::DecodeError),
|
||||
#[display(fmt = "Failed to encode response: {}.", _0)]
|
||||
EncodeProto(prost::EncodeError),
|
||||
#[display(fmt = "Failed to send response.")]
|
||||
#[error("Failed to decode request: {0}.")]
|
||||
DecodeProto(#[from] prost::DecodeError),
|
||||
#[error("Failed to encode response: {0}.")]
|
||||
EncodeProto(#[from] prost::EncodeError),
|
||||
#[error("Failed to send response.")]
|
||||
SendResponse,
|
||||
/// A bad request has been received.
|
||||
#[display(fmt = "bad request: {}", _0)]
|
||||
#[error("bad request: {0}")]
|
||||
BadRequest(&'static str),
|
||||
/// Encoding or decoding of some data failed.
|
||||
#[display(fmt = "codec error: {}", _0)]
|
||||
Codec(codec::Error),
|
||||
#[error("codec error: {0}")]
|
||||
Codec(#[from] codec::Error),
|
||||
}
|
||||
|
||||
fn fmt_keys(first: Option<&Vec<u8>>, last: Option<&Vec<u8>>) -> String {
|
||||
|
||||
Reference in New Issue
Block a user