- out_c = out_c + "static inline LDK" + struct_name + " LDK" + struct_name + "_from_java(" + self.c_fn_args_pfx + ") {\n"
- out_c = out_c + "\tswitch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {\n"
+ out_c += "static inline LDK" + struct_name + " LDK" + struct_name + "_from_java(" + self.c_fn_args_pfx + ") {\n"
+ out_c += "\tjint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);\n"
+ out_c += "\tif (UNLIKELY((*env)->ExceptionCheck(env))) {\n"
+ out_c += "\t\t(*env)->ExceptionDescribe(env);\n"
+ out_c += "\t\t(*env)->FatalError(env, \"A call to " + struct_name + ".ordinal() from rust threw an exception.\");\n"
+ out_c += "\t}\n"
+ out_c += "\tswitch (ord) {\n"