You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-25 15:37:42 +00:00
Implement error return documetation
Adds ability to add error return documetation to the binder and class reference.
Usage example:
```C++
void MyClass::_bind_method() {
[..]
BIND_METHOD_ERR_RETURN_DOC("load", ERR_FILE_CANT_OPEN, ERR_FILE_UNRECOGNIZED);
}
```
One function of ConfigFile was changed as example.
This commit is contained in:
@@ -892,6 +892,32 @@ void ClassDB::get_enum_constants(const StringName &p_class, const StringName &p_
|
||||
}
|
||||
}
|
||||
|
||||
void ClassDB::set_method_error_return_values(const StringName &p_class, const StringName &p_method, const Vector<Error> &p_values) {
|
||||
OBJTYPE_RLOCK;
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
ClassInfo *type = classes.getptr(p_class);
|
||||
|
||||
ERR_FAIL_COND(!type);
|
||||
|
||||
type->method_error_values[p_method] = p_values;
|
||||
#endif
|
||||
}
|
||||
|
||||
Vector<Error> ClassDB::get_method_error_return_values(const StringName &p_class, const StringName &p_method) {
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
ClassInfo *type = classes.getptr(p_class);
|
||||
|
||||
ERR_FAIL_COND_V(!type, Vector<Error>());
|
||||
|
||||
if (!type->method_error_values.has(p_method)) {
|
||||
return Vector<Error>();
|
||||
}
|
||||
return type->method_error_values[p_method];
|
||||
#else
|
||||
return Vector<Error>();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ClassDB::has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) {
|
||||
OBJTYPE_RLOCK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user