1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * An Err type for failure to process messages.
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class LightningError extends CommonBase {
14 LightningError(Object _dummy, long ptr) { super(ptr); }
15 @Override @SuppressWarnings("deprecation")
16 protected void finalize() throws Throwable {
18 if (ptr != 0) { bindings.LightningError_free(ptr); }
22 * A human-readable message describing the error
24 public String get_err() {
25 String ret = bindings.LightningError_get_err(this.ptr);
30 * A human-readable message describing the error
32 public void set_err(String val) {
33 bindings.LightningError_set_err(this.ptr, val);
37 * The action which should be taken against the offending peer.
39 public ErrorAction get_action() {
40 long ret = bindings.LightningError_get_action(this.ptr);
41 if (ret < 1024) { return null; }
42 ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret);
43 ret_hu_conv.ptrs_to.add(this);
48 * The action which should be taken against the offending peer.
50 public void set_action(ErrorAction val) {
51 bindings.LightningError_set_action(this.ptr, val.ptr);
55 * Constructs a new LightningError given each field
57 public static LightningError of(String err_arg, ErrorAction action_arg) {
58 long ret = bindings.LightningError_new(err_arg, action_arg.ptr);
59 if (ret < 1024) { return null; }
60 LightningError ret_hu_conv = new LightningError(null, ret);
61 ret_hu_conv.ptrs_to.add(ret_hu_conv);
66 * Creates a copy of the LightningError
68 public LightningError clone() {
69 long ret = bindings.LightningError_clone(this.ptr);
70 if (ret < 1024) { return null; }
71 LightningError ret_hu_conv = new LightningError(null, ret);
72 ret_hu_conv.ptrs_to.add(this);