Skip to content

Commit eabf05a

Browse files
RobProductionsjss2a98aj
authored andcommitted
Add error messages to binding generator
1 parent 23c1038 commit eabf05a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

modules/mono/editor/bindings_generator.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ Error BindingsGenerator::_populate_method_icalls_table(const TypeInterface &p_it
14521452
}
14531453

14541454
const TypeInterface *return_type = _get_type_or_null(imethod.return_type);
1455-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
1455+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + imethod.return_type.cname + "' was not found.");
14561456

14571457
String im_unique_sig = get_ret_unique_sig(return_type) + ",CallMethodBind";
14581458

@@ -1463,7 +1463,7 @@ Error BindingsGenerator::_populate_method_icalls_table(const TypeInterface &p_it
14631463
// Get arguments information
14641464
for (const ArgumentInterface &iarg : imethod.arguments) {
14651465
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
1466-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
1466+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
14671467

14681468
im_unique_sig += ",";
14691469
im_unique_sig += get_arg_unique_sig(*arg_type);
@@ -2313,7 +2313,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
23132313
const ArgumentInterface &iarg = *itr;
23142314

23152315
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
2316-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2316+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
23172317

23182318
if (i != 0) {
23192319
output << ", ";
@@ -2333,7 +2333,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
23332333

23342334
if (imethod.return_type.cname != name_cache.type_void) {
23352335
const TypeInterface *return_type = _get_type_or_null(imethod.return_type);
2336-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
2336+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + imethod.return_type.cname + "' was not found.");
23372337

23382338
output << INDENT3 "ret = "
23392339
<< sformat(return_type->cs_managed_to_variant, "callRet", return_type->cs_type, return_type->name)
@@ -2552,7 +2552,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
25522552
const TypeReference &proptype_name = getter ? getter->return_type : setter->arguments.back()->get().type;
25532553

25542554
const TypeInterface *prop_itype = _get_type_or_singleton_or_null(proptype_name);
2555-
ERR_FAIL_NULL_V(prop_itype, ERR_BUG); // Property type not found
2555+
ERR_FAIL_NULL_V_MSG(prop_itype, ERR_BUG, "Property type '" + proptype_name.cname + "' was not found.");
25562556

25572557
ERR_FAIL_COND_V_MSG(prop_itype->is_singleton, ERR_BUG,
25582558
"Property type is a singleton: '" + p_itype.name + "." + String(p_iprop.cname) + "'.");
@@ -2651,7 +2651,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
26512651

26522652
Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterface &p_itype, const BindingsGenerator::MethodInterface &p_imethod, int &p_method_bind_count, StringBuilder &p_output) {
26532653
const TypeInterface *return_type = _get_type_or_singleton_or_null(p_imethod.return_type);
2654-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
2654+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + p_imethod.return_type.cname + "' was not found.");
26552655

26562656
ERR_FAIL_COND_V_MSG(return_type->is_singleton, ERR_BUG,
26572657
"Method return type is a singleton: '" + p_itype.name + "." + p_imethod.name + "'.");
@@ -2690,7 +2690,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
26902690
const ArgumentInterface &first = p_imethod.arguments.front()->get();
26912691
for (const ArgumentInterface &iarg : p_imethod.arguments) {
26922692
const TypeInterface *arg_type = _get_type_or_singleton_or_null(iarg.type);
2693-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2693+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
26942694

26952695
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
26962696
"Argument type is a singleton: '" + iarg.name + "' of method '" + p_itype.name + "." + p_imethod.name + "'.");
@@ -2944,7 +2944,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
29442944
const ArgumentInterface &first = p_isignal.arguments.front()->get();
29452945
for (const ArgumentInterface &iarg : p_isignal.arguments) {
29462946
const TypeInterface *arg_type = _get_type_or_singleton_or_null(iarg.type);
2947-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2947+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
29482948

29492949
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
29502950
"Argument type is a singleton: '" + iarg.name + "' of signal '" + p_itype.name + "." + p_isignal.name + "'.");
@@ -3013,7 +3013,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
30133013
int idx = 0;
30143014
for (const ArgumentInterface &iarg : p_isignal.arguments) {
30153015
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
3016-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
3016+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
30173017

30183018
if (idx != 0) {
30193019
p_output << ", ";
@@ -3113,7 +3113,7 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall,
31133113
bool ret_void = p_icall.return_type.cname == name_cache.type_void;
31143114

31153115
const TypeInterface *return_type = _get_type_or_null(p_icall.return_type);
3116-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
3116+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + p_icall.return_type.cname + "' was not found.");
31173117

31183118
StringBuilder c_func_sig;
31193119
StringBuilder c_in_statements;
@@ -3129,7 +3129,7 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall,
31293129
int i = 0;
31303130
for (const TypeReference &arg_type_ref : p_icall.argument_types) {
31313131
const TypeInterface *arg_type = _get_type_or_null(arg_type_ref);
3132-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Return type not found
3132+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + arg_type_ref.cname + "' was not found.");
31333133

31343134
String c_param_name = "arg" + itos(i + 1);
31353135

@@ -3389,7 +3389,7 @@ const String BindingsGenerator::_get_generic_type_parameters(const TypeInterface
33893389
String params = "<";
33903390
for (const TypeReference &param_type : p_generic_type_parameters) {
33913391
const TypeInterface *param_itype = _get_type_or_singleton_or_null(param_type);
3392-
ERR_FAIL_NULL_V(param_itype, ""); // Parameter type not found
3392+
ERR_FAIL_NULL_V_MSG(param_itype, "", "Parameter type '" + param_type.cname + "' was not found.");
33933393

33943394
ERR_FAIL_COND_V_MSG(param_itype->is_singleton, "",
33953395
"Generic type parameter is a singleton: '" + param_itype->name + "'.");

0 commit comments

Comments
 (0)