]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Make APIError debug output more clear by including the variant
authorMatt Corallo <git@bluematt.me>
Sun, 17 Oct 2021 21:24:53 +0000 (21:24 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 6 Dec 2021 18:39:37 +0000 (18:39 +0000)
lightning/src/util/errors.rs

index 6495d9de4ed5363fb4a2b70c958366653797121c..0c6099f7d5a5e2e8de07bafa1906da8f1edc6538 100644 (file)
@@ -66,10 +66,10 @@ pub enum APIError {
 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::APIMisuseError {ref err} => write!(f, "Misuse error: {}", 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),
+                       APIError::RouteError {ref err} => write!(f, "Route error: {}", err),
+                       APIError::ChannelUnavailable {ref err} => write!(f, "Channel unavailable: {}", err),
                        APIError::MonitorUpdateFailed => f.write_str("Client indicated a channel monitor update failed"),
                        APIError::IncompatibleShutdownScript { ref script } => {
                                write!(f, "Provided a scriptpubkey format not accepted by peer: {}", script)