X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Futil%2Ferrors.rs;h=9b0e757de971217a60fdb9925872f3a1bbd68f6a;hb=HEAD;hp=6513beefe794e82f9651e61b55739a5f7d8b651a;hpb=a82a5f71dac03181145e78c90145e8a036fac2c5;p=rust-lightning diff --git a/src/util/errors.rs b/src/util/errors.rs deleted file mode 100644 index 6513beef..00000000 --- a/src/util/errors.rs +++ /dev/null @@ -1,48 +0,0 @@ -//! Error types live here. - -use std::fmt; - -/// Indicates an error on the client's part (usually some variant of attempting to use too-low or -/// too-high values) -pub enum APIError { - /// Indicates the API was wholly misused (see err for more). Cases where these can be returned - /// are documented, but generally indicates some precondition of a function was violated. - APIMisuseError { - /// A human-readable error message - err: &'static str - }, - /// Due to a high feerate, we were unable to complete the request. - /// For example, this may be returned if the feerate implies we cannot open a channel at the - /// requested value, but opening a larger channel would succeed. - FeeRateTooHigh { - /// A human-readable error message - err: String, - /// The feerate which was too high. - feerate: u64 - }, - - /// Invalid route or parameters (cltv_delta, fee, pubkey) was specified - RouteError { - /// A human-readable error message - err: &'static str - }, - - - /// We were unable to complete the request since channel is disconnected or - /// shutdown in progress initiated by remote - ChannelUnavailable { - /// A human-readable error message - err: &'static str - } -} - -impl fmt::Debug for APIError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - APIError::APIMisuseError {ref err} => f.write_str(err), - APIError::FeeRateTooHigh {ref err, ref feerate} => write!(f, "{} feerate: {}", err, feerate), - APIError::RouteError {ref err} => f.write_str(err), - APIError::ChannelUnavailable {ref err} => f.write_str(err), - } - } -}