Add a new manual type - UnqualifiedError/LDKError
[ldk-java] / gen_type_mapping.py
index 9cee9ab454773332293ae6711bf8b5b6e5e2159f..ad7d46fcfa5b8ce1628503f8e33fe6bac83c7b9e 100644 (file)
@@ -486,7 +486,15 @@ class TypeMappingGenerator:
                         to_hu_conv = self.consts.var_decl_statement(ty_info.java_hu_ty, ty_info.var_name + "_hu_conv", "new " + ty_info.java_hu_ty + "(null, " + ty_info.var_name + ")") + ";" + to_hu_conv_sfx,
                         to_hu_conv_name = ty_info.var_name + "_hu_conv", from_hu_conv = from_hu_conv)
 
-                # The manually-defined types - TxOut and u5
+                # The manually-defined types - TxOut, u5, and Error
+                if ty_info.rust_obj == "LDKError":
+                    assert from_hu_conv is None
+                    return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,
+                        arg_conv = "", arg_conv_name = "(LDKError){ ._dummy = 0 }", arg_conv_cleanup = None,
+                        ret_conv = ("/*", "*/"), ret_conv_name = "0",
+                        to_hu_conv = self.consts.var_decl_statement(ty_info.java_hu_ty, ty_info.var_name + "_conv", "new " + ty_info.java_hu_ty + "(" + ty_info.var_name + ")") + ";",
+                        to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = ("0", ""))
+
                 if ty_info.rust_obj == "LDKu5":
                     assert from_hu_conv is None
                     return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,