Merge pull request #49792 from EricEzaM/improve-object-errors
Improved some error messages (from ERR_FAIL_*) in Object.
This commit is contained in:
commit
0638ca0037
|
@ -920,7 +920,7 @@ void Object::set_meta(const String &p_name, const Variant &p_value) {
|
|||
}
|
||||
|
||||
Variant Object::get_meta(const String &p_name) const {
|
||||
ERR_FAIL_COND_V(!metadata.has(p_name), Variant());
|
||||
ERR_FAIL_COND_V_MSG(!metadata.has(p_name), Variant(), "The object does not have any 'meta' values with the key '" + p_name + "'.");
|
||||
return metadata[p_name];
|
||||
}
|
||||
|
||||
|
@ -1287,10 +1287,10 @@ void Object::get_signals_connected_to_this(List<Connection> *p_connections) cons
|
|||
}
|
||||
|
||||
Error Object::connect(const StringName &p_signal, const Callable &p_callable, const Vector<Variant> &p_binds, uint32_t p_flags) {
|
||||
ERR_FAIL_COND_V(p_callable.is_null(), ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(p_callable.is_null(), ERR_INVALID_PARAMETER, "Cannot connect to '" + p_signal + "': the provided callable is null.");
|
||||
|
||||
Object *target_object = p_callable.get_object();
|
||||
ERR_FAIL_COND_V(!target_object, ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V_MSG(!target_object, ERR_INVALID_PARAMETER, "Cannot connect to '" + p_signal + "' to callable '" + p_callable + "': the callable object is null.");
|
||||
|
||||
SignalData *s = signal_map.getptr(p_signal);
|
||||
if (!s) {
|
||||
|
@ -1348,7 +1348,7 @@ Error Object::connect(const StringName &p_signal, const Callable &p_callable, co
|
|||
}
|
||||
|
||||
bool Object::is_connected(const StringName &p_signal, const Callable &p_callable) const {
|
||||
ERR_FAIL_COND_V(p_callable.is_null(), false);
|
||||
ERR_FAIL_COND_V_MSG(p_callable.is_null(), false, "Cannot determine if connected to '" + p_signal + "': the provided callable is null.");
|
||||
const SignalData *s = signal_map.getptr(p_signal);
|
||||
if (!s) {
|
||||
bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal);
|
||||
|
@ -1375,10 +1375,10 @@ void Object::disconnect(const StringName &p_signal, const Callable &p_callable)
|
|||
}
|
||||
|
||||
void Object::_disconnect(const StringName &p_signal, const Callable &p_callable, bool p_force) {
|
||||
ERR_FAIL_COND(p_callable.is_null());
|
||||
ERR_FAIL_COND_MSG(p_callable.is_null(), "Cannot disconnect from '" + p_signal + "': the provided callable is null.");
|
||||
|
||||
Object *target_object = p_callable.get_object();
|
||||
ERR_FAIL_COND(!target_object);
|
||||
ERR_FAIL_COND_MSG(!target_object, "Cannot disconnect '" + p_signal + "' from callable '" + p_callable + "': the callable object is null.");
|
||||
|
||||
SignalData *s = signal_map.getptr(p_signal);
|
||||
if (!s) {
|
||||
|
|
Loading…
Reference in New Issue