Skip to content

Commit 2d46c02

Browse files
committed
Merge #127: Remove unnecessary error variants
2e13aad Remove unnecessary error variants (GideonBature) Pull request description: This commit removes the `Secp256k1` and `InvalidAmount` variants, their `From` impls, and updates the `Display` and `Error::source` methods accordingly. Closes #119 ACKs for top commit: jrakibi: ACK 2e13aad tcharding: ACK 2e13aad Tree-SHA512: 982a43d45321b045d5330e581e43621aef5d8596dd40ef4047c645795598a0a2398dba2b813374b2283250bad5169e495bc2be3a9db96323138e339b25cf13b9
2 parents cb977ee + 2e13aad commit 2d46c02

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

client/src/client_sync/error.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::{error, fmt, io};
44

5-
use bitcoin::{hex, secp256k1};
5+
use bitcoin::hex;
66

77
/// The error type for errors produced in this library.
88
#[derive(Debug)]
@@ -12,9 +12,7 @@ pub enum Error {
1212
HexToBytes(hex::HexToBytesError),
1313
Json(serde_json::error::Error),
1414
BitcoinSerialization(bitcoin::consensus::encode::FromHexError),
15-
Secp256k1(secp256k1::Error),
1615
Io(io::Error),
17-
InvalidAmount(bitcoin::amount::ParseAmountError),
1816
InvalidCookieFile,
1917
/// The JSON result had an unexpected structure.
2018
UnexpectedStructure,
@@ -46,18 +44,10 @@ impl From<bitcoin::consensus::encode::FromHexError> for Error {
4644
fn from(e: bitcoin::consensus::encode::FromHexError) -> Error { Error::BitcoinSerialization(e) }
4745
}
4846

49-
impl From<secp256k1::Error> for Error {
50-
fn from(e: secp256k1::Error) -> Error { Error::Secp256k1(e) }
51-
}
52-
5347
impl From<io::Error> for Error {
5448
fn from(e: io::Error) -> Error { Error::Io(e) }
5549
}
5650

57-
impl From<bitcoin::amount::ParseAmountError> for Error {
58-
fn from(e: bitcoin::amount::ParseAmountError) -> Error { Error::InvalidAmount(e) }
59-
}
60-
6151
impl fmt::Display for Error {
6252
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6353
use Error::*;
@@ -68,9 +58,7 @@ impl fmt::Display for Error {
6858
HexToBytes(ref e) => write!(f, "hex to bytes decode error: {}", e),
6959
Json(ref e) => write!(f, "JSON error: {}", e),
7060
BitcoinSerialization(ref e) => write!(f, "Bitcoin serialization error: {}", e),
71-
Secp256k1(ref e) => write!(f, "secp256k1 error: {}", e),
7261
Io(ref e) => write!(f, "I/O error: {}", e),
73-
InvalidAmount(ref e) => write!(f, "invalid amount: {}", e),
7462
InvalidCookieFile => write!(f, "invalid cookie file"),
7563
UnexpectedStructure => write!(f, "the JSON result had an unexpected structure"),
7664
Returned(ref s) => write!(f, "the daemon returned an error string: {}", s),
@@ -90,9 +78,7 @@ impl error::Error for Error {
9078
HexToBytes(ref e) => Some(e),
9179
Json(ref e) => Some(e),
9280
BitcoinSerialization(ref e) => Some(e),
93-
Secp256k1(ref e) => Some(e),
9481
Io(ref e) => Some(e),
95-
InvalidAmount(ref e) => Some(e),
9682
ServerVersion(ref e) => Some(e),
9783
InvalidCookieFile | UnexpectedStructure | Returned(_) | MissingUserPassword => None,
9884
}

0 commit comments

Comments
 (0)