Merge pull request #1892 from tnull/2022-12-spendableoutputdescriptor-doccs
[rust-lightning] / lightning / src / util / errors.rs
index 15dd202b9c83a96064257c3fa528592021594eb8..17e55a9799bb503c987782a2937c52a00634abdf 100644 (file)
@@ -9,14 +9,14 @@
 
 //! Error types live here.
 
-use ln::script::ShutdownScript;
+use crate::ln::script::ShutdownScript;
 
 use alloc::string::String;
 use core::fmt;
 
 /// Indicates an error on the client's part (usually some variant of attempting to use too-low or
 /// too-high values)
-#[derive(Clone, PartialEq)]
+#[derive(Clone, PartialEq, Eq)]
 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.
@@ -35,7 +35,7 @@ pub enum APIError {
        },
        /// A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
        /// too-many-hops, etc).
-       RouteError {
+       InvalidRoute {
                /// A human-readable error message
                err: &'static str
        },
@@ -46,13 +46,15 @@ pub enum APIError {
                /// A human-readable error message
                err: String
        },
-       /// An attempt to call watch/update_channel returned a
-       /// [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a monitor update
-       /// is awaiting async resolution. Once it resolves the attempted action should complete
-       /// automatically.
+       /// An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`]
+       /// returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a
+       /// monitor update is awaiting async resolution. Once it resolves the attempted action should
+       /// complete automatically.
        ///
+       /// [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel
+       /// [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel
        /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
-       MonitorUpdateFailed,
+       MonitorUpdateInProgress,
        /// [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
        /// with the channel counterparty as negotiated in [`InitFeatures`].
        ///
@@ -72,9 +74,9 @@ impl fmt::Debug for APIError {
                match *self {
                        APIError::APIMisuseError {ref err} => write!(f, "Misuse error: {}", err),
                        APIError::FeeRateTooHigh {ref err, ref feerate} => write!(f, "{} feerate: {}", err, feerate),
-                       APIError::RouteError {ref err} => write!(f, "Route error: {}", err),
+                       APIError::InvalidRoute {ref err} => write!(f, "Invalid route provided: {}", err),
                        APIError::ChannelUnavailable {ref err} => write!(f, "Channel unavailable: {}", err),
-                       APIError::MonitorUpdateFailed => f.write_str("Client indicated a channel monitor update failed"),
+                       APIError::MonitorUpdateInProgress => f.write_str("Client indicated a channel monitor update is in progress but not yet complete"),
                        APIError::IncompatibleShutdownScript { ref script } => {
                                write!(f, "Provided a scriptpubkey format not accepted by peer: {}", script)
                        },