projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #185 from TheBlueMatt/2018-09-ser-rework
[rust-lightning]
/
src
/
util
/
errors.rs
diff --git
a/src/util/errors.rs
b/src/util/errors.rs
index 0700b451c670d67fce74d0a4f3f42a9b2554dacf..23a349e3e850f9e6aed90dee6058f95a6d8587a5 100644
(file)
--- a/
src/util/errors.rs
+++ b/
src/util/errors.rs
@@
-1,15
+1,26
@@
use std::fmt;
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 {
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 {err: &'static str},
APIMisuseError {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 {err: String, feerate: u64},
FeeRateTooHigh {err: String, feerate: u64},
+
+ /// Invalid route or parameters (cltv_delta, fee, pubkey) was specified
+ RouteError {err: &'static str},
}
impl fmt::Debug for APIError {
}
impl fmt::Debug for APIError {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
APIError::APIMisuseError {ref err} => f.write_str(err),
match *self {
APIError::APIMisuseError {ref err} => f.write_str(err),
- APIError::FeeRateTooHigh {ref err, ref feerate} => write!(f, "{} feerate: {}", err, feerate)
+ APIError::FeeRateTooHigh {ref err, ref feerate} => write!(f, "{} feerate: {}", err, feerate),
+ APIError::RouteError {ref err} => f.write_str(err),
}
}
- }
+
}
}
}