]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #122 from TheBlueMatt/2018-08-doc-usability-fixes
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Mon, 20 Aug 2018 17:57:35 +0000 (13:57 -0400)
committerGitHub <noreply@github.com>
Mon, 20 Aug 2018 17:57:35 +0000 (13:57 -0400)
Simple log usability fix, add some missing docs

src/ln/channel.rs
src/ln/channelmanager.rs
src/ln/peer_handler.rs
src/util/errors.rs
src/util/logger.rs
src/util/macro_logger.rs

index b2164696f25897c48536ec64692730a1a1eb1d38..c7c3208e78e3007293e7171074f52d555aa1ba60 100644 (file)
@@ -23,7 +23,7 @@ use chain::chaininterface::{FeeEstimator,ConfirmationTarget};
 use chain::transaction::OutPoint;
 use util::{transaction_utils,rng};
 use util::sha2::Sha256;
-use util::logger::{Logger, Record};
+use util::logger::Logger;
 use util::errors::APIError;
 
 use std;
index 03cad49ea56af9cf051e1cb2c5e173b3965033b4..d273be52b8fcc43b4b8a17ddccc3c3a724b61c36 100644 (file)
@@ -20,7 +20,7 @@ use ln::msgs::{HandleError,ChannelMessageHandler,MsgEncodable,MsgDecodable};
 use util::{byte_utils, events, internal_traits, rng};
 use util::sha2::Sha256;
 use util::chacha20poly1305rfc::ChaCha20;
-use util::logger::{Logger, Record};
+use util::logger::Logger;
 use util::errors::APIError;
 
 use crypto;
index b44ddc515b54d96fc35b970eb752c2ca7cfddc56..11064bf989f5e498b034cefcfd11253e7d9f93da 100644 (file)
@@ -5,7 +5,7 @@ use ln::msgs::{MsgEncodable,MsgDecodable};
 use ln::peer_channel_encryptor::{PeerChannelEncryptor,NextNoiseStep};
 use util::byte_utils;
 use util::events::{EventsProvider,Event};
-use util::logger::{Logger, Record};
+use util::logger::Logger;
 
 use std::collections::{HashMap,LinkedList};
 use std::sync::{Arc, Mutex};
index 0700b451c670d67fce74d0a4f3f42a9b2554dacf..71e5eed67f26abf7892ab698aaf5c723f6fad271 100644 (file)
@@ -1,15 +1,22 @@
 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 {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},
 }
 
 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),
                        APIError::FeeRateTooHigh {ref err, ref feerate} => write!(f, "{} feerate: {}", err, feerate)
                }
-  }
+       }
 }
index bccc8cd21cfabd6df2f230ddd00db1ce2d39e0f1..720bccf4140d8f7053c7e0e96b1015a2523716b2 100644 (file)
@@ -126,7 +126,7 @@ pub trait Logger: Sync + Send {
 
 #[cfg(test)]
 mod tests {
-       use util::logger::{Logger, Level, Record};
+       use util::logger::{Logger, Level};
        use util::test_utils::TestLogger;
        use std::sync::{Arc};
 
index fd9a61b39374a0b9f6d53c8866ede69daaa0261b..19f0294f9c220a52942a48ee48f58238c0fe52ba 100644 (file)
@@ -52,7 +52,7 @@ macro_rules! log_funding_channel_id {
 
 macro_rules! log_internal {
        ($self: ident, $lvl:expr, $($arg:tt)+) => (
-               &$self.logger.log(&Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()));
+               &$self.logger.log(&::util::logger::Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()));
        );
 }