X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Futil%2Ferrors.rs;h=526138297a7b1e7e38828c386591aa95ed14f49b;hb=b2f0ccc7e0ef8b31567cb017d0b7cce9f7204803;hp=9b0e757de971217a60fdb9925872f3a1bbd68f6a;hpb=1495575b517c90da925698da14f627bf0d5b313f;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/util/errors.rs b/lightning-c-bindings/src/util/errors.rs index 9b0e757..5261382 100644 --- a/lightning-c-bindings/src/util/errors.rs +++ b/lightning-c-bindings/src/util/errors.rs @@ -1,3 +1,11 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + //! Error types live here. use std::ffi::c_void; @@ -13,24 +21,29 @@ 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 { + /// A human-readable error message err: crate::c_types::derived::CVec_u8Z, }, /// 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 { + /// A human-readable error message err: crate::c_types::derived::CVec_u8Z, + /// The feerate which was too high. feerate: u32, }, /// A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, /// too-many-hops, etc). RouteError { + /// A human-readable error message err: crate::c_types::Str, }, /// We were unable to complete the request as the Channel required to do so is unable to /// complete the request (or was not found). This can take many forms, including disconnected /// peer, channel at capacity, channel shutting down, etc. ChannelUnavailable { + /// A human-readable error message err: crate::c_types::derived::CVec_u8Z, }, /// An attempt to call watch/update_channel returned an Err (ie you did this!), causing the @@ -158,8 +171,10 @@ impl APIError { } } } +/// Frees any resources used by the APIError #[no_mangle] pub extern "C" fn APIError_free(this_ptr: APIError) { } +/// Creates a copy of the APIError #[no_mangle] pub extern "C" fn APIError_clone(orig: &APIError) -> APIError { orig.clone()