1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class APIError extends CommonBase {
10 private APIError(Object _dummy, long ptr) { super(ptr); }
11 @Override @SuppressWarnings("deprecation")
12 protected void finalize() throws Throwable {
14 if (ptr != 0) { bindings.APIError_free(ptr); }
16 static APIError constr_from_ptr(long ptr) {
17 bindings.LDKAPIError raw_val = bindings.LDKAPIError_ref_from_ptr(ptr);
18 if (raw_val.getClass() == bindings.LDKAPIError.APIMisuseError.class) {
19 return new APIMisuseError(ptr, (bindings.LDKAPIError.APIMisuseError)raw_val);
21 if (raw_val.getClass() == bindings.LDKAPIError.FeeRateTooHigh.class) {
22 return new FeeRateTooHigh(ptr, (bindings.LDKAPIError.FeeRateTooHigh)raw_val);
24 if (raw_val.getClass() == bindings.LDKAPIError.RouteError.class) {
25 return new RouteError(ptr, (bindings.LDKAPIError.RouteError)raw_val);
27 if (raw_val.getClass() == bindings.LDKAPIError.ChannelUnavailable.class) {
28 return new ChannelUnavailable(ptr, (bindings.LDKAPIError.ChannelUnavailable)raw_val);
30 if (raw_val.getClass() == bindings.LDKAPIError.MonitorUpdateFailed.class) {
31 return new MonitorUpdateFailed(ptr, (bindings.LDKAPIError.MonitorUpdateFailed)raw_val);
33 assert false; return null; // Unreachable without extending the (internal) bindings interface
36 public final static class APIMisuseError extends APIError {
37 public final byte[] err;
38 private APIMisuseError(long ptr, bindings.LDKAPIError.APIMisuseError obj) {
43 public final static class FeeRateTooHigh extends APIError {
44 public final byte[] err;
45 public final int feerate;
46 private FeeRateTooHigh(long ptr, bindings.LDKAPIError.FeeRateTooHigh obj) {
49 this.feerate = obj.feerate;
52 public final static class RouteError extends APIError {
53 public final String err;
54 private RouteError(long ptr, bindings.LDKAPIError.RouteError obj) {
59 public final static class ChannelUnavailable extends APIError {
60 public final byte[] err;
61 private ChannelUnavailable(long ptr, bindings.LDKAPIError.ChannelUnavailable obj) {
66 public final static class MonitorUpdateFailed extends APIError {
67 private MonitorUpdateFailed(long ptr, bindings.LDKAPIError.MonitorUpdateFailed obj) {