@@ -162,13 +162,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
162
162
163
163
_super_implicit_constructor (this , instance, r_error);
164
164
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);
165
166
instance->script = Ref<GDScript>();
166
167
instance->owner ->set_script_instance (nullptr );
167
168
{
168
169
MutexLock lock (GDScriptLanguage::singleton->mutex );
169
170
instances.erase (p_owner);
170
171
}
171
- ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance. " );
172
+ ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance: " + error_text );
172
173
}
173
174
174
175
if (p_argcount < 0 ) {
@@ -179,13 +180,14 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
179
180
if (initializer != nullptr ) {
180
181
initializer->call (instance, p_args, p_argcount, r_error);
181
182
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);
182
184
instance->script = Ref<GDScript>();
183
185
instance->owner ->set_script_instance (nullptr );
184
186
{
185
187
MutexLock lock (GDScriptLanguage::singleton->mutex );
186
188
instances.erase (p_owner);
187
189
}
188
- ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance. " );
190
+ ERR_FAIL_V_MSG (nullptr , " Error constructing a GDScriptInstance: " + error_text );
189
191
}
190
192
}
191
193
// @TODO make thread safe
0 commit comments