Skip to content

Commit

Permalink
Output error message when set default property values
Browse files Browse the repository at this point in the history
  • Loading branch information
Geequlim committed Jun 25, 2020
1 parent de5323b commit 3b6a0a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion quickjs/quickjs_binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,14 @@ ECMAScriptGCHandler QuickJSBinder::create_ecma_instance_for_godot_object(const E
const StringName *prop_name = p_class->properties.next(NULL);
while (prop_name) {
JSAtom pname = get_atom(ctx, *prop_name);
JS_SetProperty(ctx, object, pname, variant_to_var(ctx, p_class->properties.getptr(*prop_name)->default_value));
int ret = JS_SetProperty(ctx, object, pname, variant_to_var(ctx, p_class->properties.getptr(*prop_name)->default_value));
if (ret < 0) {
JSValue e = JS_GetException(ctx);
ECMAscriptScriptError error;
dump_exception(ctx, e, &error);
JS_FreeValue(ctx, e);
ERR_PRINTS(error_to_string(error));
}
JS_FreeAtom(ctx, pname);
prop_name = p_class->properties.next(prop_name);
}
Expand Down

0 comments on commit 3b6a0a2

Please sign in to comment.