@@ -27,14 +27,11 @@ pub enum Error {
2727 /// Error modeling [`GetBlockFilter`](corepc_types::model::GetBlockFilter)
2828 GetBlockFilter ( GetBlockFilterError ) ,
2929
30- /// Missing authentication credentials.
31- MissingAuthentication ,
32-
3330 /// Invalid or corrupted cookie file.
3431 InvalidCookieFile ,
3532
36- /// Invalid response from the RPC server.
37- InvalidResponse ( String ) ,
33+ /// The provided URL is syntactically incorrect
34+ InvalidUrl ( String ) ,
3835
3936 /// JSON-RPC error from the server.
4037 JsonRpc ( jsonrpc:: Error ) ,
@@ -55,20 +52,34 @@ pub enum Error {
5552impl fmt:: Display for Error {
5653 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5754 match self {
58- Error :: MissingAuthentication => {
59- write ! ( f, "authentication is required but none was provided" )
60- }
61- Error :: InvalidCookieFile => write ! ( f, "invalid cookie file" ) ,
62- Error :: InvalidResponse ( e) => write ! ( f, "invalid response: {e}" ) ,
63- Error :: HexToArray ( e) => write ! ( f, "Hash parsing eror: {e}" ) ,
55+ Error :: DecodeHex ( e) => write ! ( f, "hex deserialization error: {e}" ) ,
56+ Error :: GetBlockVerboseOne ( e) => write ! ( f, "block verbose error: {e}" ) ,
57+ Error :: GetBlockHeaderVerbose ( e) => write ! ( f, "block header verbose error: {e}" ) ,
58+ Error :: GetBlockFilter ( e) => write ! ( f, "block filter error: {e}" ) ,
59+ Error :: InvalidCookieFile => write ! ( f, "invalid or missing cookie file" ) ,
60+ Error :: InvalidUrl ( e) => write ! ( f, "invalid RPC URL: {e}" ) ,
61+ Error :: HexToArray ( e) => write ! ( f, "hash parsing error: {e}" ) ,
6462 Error :: JsonRpc ( e) => write ! ( f, "JSON-RPC error: {e}" ) ,
6563 Error :: Json ( e) => write ! ( f, "JSON error: {e}" ) ,
6664 Error :: Io ( e) => write ! ( f, "I/O error: {e}" ) ,
67- Error :: DecodeHex ( e) => write ! ( f, "Hex deserialization error: {e}" ) ,
68- Error :: GetBlockHeaderVerbose ( e) => write ! ( f, "{e}" ) ,
69- Error :: GetBlockVerboseOne ( e) => write ! ( f, "{e}" ) ,
70- Error :: TryFromInt ( e) => write ! ( f, "Integer conversion overflow error: {e}" ) ,
71- Error :: GetBlockFilter ( e) => write ! ( f, "{e}" ) ,
65+ Error :: TryFromInt ( e) => write ! ( f, "integer conversion overflow: {e}" ) ,
66+ }
67+ }
68+ }
69+
70+ impl std:: error:: Error for Error {
71+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
72+ match self {
73+ Error :: DecodeHex ( e) => Some ( e) ,
74+ Error :: JsonRpc ( e) => Some ( e) ,
75+ Error :: HexToArray ( e) => Some ( e) ,
76+ Error :: Json ( e) => Some ( e) ,
77+ Error :: Io ( e) => Some ( e) ,
78+ Error :: TryFromInt ( e) => Some ( e) ,
79+ Error :: GetBlockVerboseOne ( e) => Some ( e) ,
80+ Error :: GetBlockHeaderVerbose ( e) => Some ( e) ,
81+ Error :: GetBlockFilter ( e) => Some ( e) ,
82+ _ => None ,
7283 }
7384 }
7485}
0 commit comments