@@ -34,7 +34,9 @@ use stacks::types::chainstate::BurnchainHeaderHash;
34
34
use stacks:: util:: hash:: hex_bytes;
35
35
use stacks_common:: deps_common:: bitcoin:: blockdata:: script:: Script ;
36
36
use stacks_common:: deps_common:: bitcoin:: blockdata:: transaction:: Transaction ;
37
- use stacks_common:: deps_common:: bitcoin:: network:: serialize:: serialize_hex;
37
+ use stacks_common:: deps_common:: bitcoin:: network:: serialize:: {
38
+ serialize_hex, Error as bitcoin_serialize_error,
39
+ } ;
38
40
39
41
use crate :: burnchains:: rpc:: rpc_transport:: { RpcAuth , RpcError , RpcTransport } ;
40
42
@@ -326,34 +328,17 @@ pub struct BitcoinRpcClient {
326
328
}
327
329
328
330
/// Represents errors that can occur when using [`BitcoinRpcClient`].
329
- #[ derive( Debug ) ]
331
+ #[ derive( Debug , thiserror :: Error ) ]
330
332
pub enum BitcoinRpcClientError {
331
333
// RPC Transport errors
332
- Rpc ( RpcError ) ,
334
+ #[ error( "Rcp error: {0}" ) ]
335
+ Rpc ( #[ from] RpcError ) ,
333
336
// JSON serialization errors
334
- Serialization ( serde_json:: Error ) ,
337
+ #[ error( "Serialization error: {0}" ) ]
338
+ Serialization ( #[ from] serde_json:: Error ) ,
335
339
// Bitcoin serialization errors
336
- BitcoinSerialization ( stacks_common:: deps_common:: bitcoin:: network:: serialize:: Error ) ,
337
- }
338
-
339
- impl From < RpcError > for BitcoinRpcClientError {
340
- fn from ( err : RpcError ) -> Self {
341
- BitcoinRpcClientError :: Rpc ( err)
342
- }
343
- }
344
-
345
- impl From < serde_json:: Error > for BitcoinRpcClientError {
346
- fn from ( err : serde_json:: Error ) -> Self {
347
- BitcoinRpcClientError :: Serialization ( err)
348
- }
349
- }
350
-
351
- impl From < stacks_common:: deps_common:: bitcoin:: network:: serialize:: Error >
352
- for BitcoinRpcClientError
353
- {
354
- fn from ( err : stacks_common:: deps_common:: bitcoin:: network:: serialize:: Error ) -> Self {
355
- BitcoinRpcClientError :: BitcoinSerialization ( err)
356
- }
340
+ #[ error( "Bitcoin Serialization error: {0}" ) ]
341
+ BitcoinSerialization ( #[ from] bitcoin_serialize_error ) ,
357
342
}
358
343
359
344
/// Alias for results returned from client operations.
0 commit comments