diff options
author | Juan Linietsky <reduzio@gmail.com> | 2021-08-26 08:42:06 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-26 08:42:06 -0300 |
commit | 34e286d6a3efd101f04e7bcc84cea33a8d39452d (patch) | |
tree | b51d3c0274430f559be9eab5a592149da7ed6f8a /core/object/class_db.cpp | |
parent | 6e87d628735cb201cb3de49a723baaf60d9c942d (diff) | |
parent | 96f8254b24109884bdc3f6a7e224a8045b27ee15 (diff) | |
download | redot-engine-34e286d6a3efd101f04e7bcc84cea33a8d39452d.tar.gz |
Merge pull request #52077 from reduz/error-ret-doc
Implement error return documentation
Diffstat (limited to 'core/object/class_db.cpp')
-rw-r--r-- | core/object/class_db.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index b29b2bd421..e268a8d292 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -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; |