@@ -24,7 +24,7 @@ pub enum APIError {
24
24
/// are documented, but generally indicates some precondition of a function was violated.
25
25
APIMisuseError {
26
26
/// A human-readable error message
27
- err : String
27
+ err : String ,
28
28
} ,
29
29
/// Due to a high feerate, we were unable to complete the request.
30
30
/// For example, this may be returned if the feerate implies we cannot open a channel at the
@@ -33,20 +33,20 @@ pub enum APIError {
33
33
/// A human-readable error message
34
34
err : String ,
35
35
/// The feerate which was too high.
36
- feerate : u32
36
+ feerate : u32 ,
37
37
} ,
38
38
/// A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
39
39
/// too-many-hops, etc).
40
40
InvalidRoute {
41
41
/// A human-readable error message
42
- err : String
42
+ err : String ,
43
43
} ,
44
44
/// We were unable to complete the request as the Channel required to do so is unable to
45
45
/// complete the request (or was not found). This can take many forms, including disconnected
46
46
/// peer, channel at capacity, channel shutting down, etc.
47
47
ChannelUnavailable {
48
48
/// A human-readable error message
49
- err : String
49
+ err : String ,
50
50
} ,
51
51
/// An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
52
52
/// returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
@@ -74,11 +74,15 @@ pub enum APIError {
74
74
impl fmt:: Debug for APIError {
75
75
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
76
76
match * self {
77
- APIError :: APIMisuseError { ref err} => write ! ( f, "Misuse error: {}" , err) ,
78
- APIError :: FeeRateTooHigh { ref err, ref feerate} => write ! ( f, "{} feerate: {}" , err, feerate) ,
79
- APIError :: InvalidRoute { ref err} => write ! ( f, "Invalid route provided: {}" , err) ,
80
- APIError :: ChannelUnavailable { ref err} => write ! ( f, "Channel unavailable: {}" , err) ,
81
- APIError :: MonitorUpdateInProgress => f. write_str ( "Client indicated a channel monitor update is in progress but not yet complete" ) ,
77
+ APIError :: APIMisuseError { ref err } => write ! ( f, "Misuse error: {}" , err) ,
78
+ APIError :: FeeRateTooHigh { ref err, ref feerate } => {
79
+ write ! ( f, "{} feerate: {}" , err, feerate)
80
+ } ,
81
+ APIError :: InvalidRoute { ref err } => write ! ( f, "Invalid route provided: {}" , err) ,
82
+ APIError :: ChannelUnavailable { ref err } => write ! ( f, "Channel unavailable: {}" , err) ,
83
+ APIError :: MonitorUpdateInProgress => f. write_str (
84
+ "Client indicated a channel monitor update is in progress but not yet complete" ,
85
+ ) ,
82
86
APIError :: IncompatibleShutdownScript { ref script } => {
83
87
write ! ( f, "Provided a scriptpubkey format not accepted by peer: {}" , script)
84
88
} ,
@@ -101,9 +105,9 @@ impl_writeable_tlv_based_enum_upgradable!(APIError,
101
105
#[ inline]
102
106
pub ( crate ) fn get_onion_debug_field ( error_code : u16 ) -> ( & ' static str , usize ) {
103
107
match error_code & 0xff {
104
- 4 | 5 | 6 => ( "sha256_of_onion" , 32 ) ,
105
- 11 | 12 => ( "htlc_msat" , 8 ) ,
106
- 13 | 18 => ( "cltv_expiry" , 4 ) ,
108
+ 4 | 5 | 6 => ( "sha256_of_onion" , 32 ) ,
109
+ 11 | 12 => ( "htlc_msat" , 8 ) ,
110
+ 13 | 18 => ( "cltv_expiry" , 4 ) ,
107
111
19 => ( "incoming_htlc_msat" , 8 ) ,
108
112
20 => ( "flags" , 2 ) ,
109
113
_ => ( "" , 0 ) ,
0 commit comments