@@ -162,13 +162,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
162162
163163 _super_implicit_constructor (this , instance, r_error);
164164 if (r_error.error != Callable::CallError::CALL_OK ) {
165+ String error_text = Variant::get_call_error_text (instance->owner , " @implicit_new" , nullptr , 0 , r_error);
165166 instance->script = Ref<GDScript>();
166167 instance->owner ->set_script_instance (nullptr );
167168 {
168169 MutexLock lock (GDScriptLanguage::singleton->mutex );
169170 instances.erase (p_owner);
170171 }
171- ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance. " );
172+ ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance: " + error_text );
172173 }
173174
174175 if (p_argcount < 0 ) {
@@ -179,13 +180,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
179180 if (initializer != nullptr ) {
180181 initializer->call (instance, p_args, p_argcount, r_error);
181182 if (r_error.error != Callable::CallError::CALL_OK ) {
183+ String error_text = Variant::get_call_error_text (instance->owner , " _init" , p_args, p_argcount, r_error);
182184 instance->script = Ref<GDScript>();
183185 instance->owner ->set_script_instance (nullptr );
184186 {
185187 MutexLock lock (GDScriptLanguage::singleton->mutex );
186188 instances.erase (p_owner);
187189 }
188- ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance. " );
190+ ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance: " + error_text );
189191 }
190192 }
191193 // @TODO make thread safe
0 commit comments