diff options
author | Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> | 2024-05-12 15:41:17 +0200 |
---|---|---|
committer | Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> | 2024-05-12 15:41:17 +0200 |
commit | 250042ba355a4b1f77a8adeb0d1d1adaf7d61747 (patch) | |
tree | c89b7e6c45a3b64aaebe2cec5a9dd4fd3c5d20e2 | |
parent | ac745adb05e732a94e7f19d92a72b805902c49bf (diff) |
Send an explicit message when return type isn't an OBBjectbugfix/explicit-return-type
-rw-r--r-- | openbb_platform/core/openbb_core/app/static/package_builder.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/openbb_platform/core/openbb_core/app/static/package_builder.py b/openbb_platform/core/openbb_core/app/static/package_builder.py index 5db17483a19..5c96c5d0f46 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder.py @@ -319,8 +319,13 @@ class ImportDefinition: hint_type_list.append(parameter.annotation) if return_type: - hint_type = get_args(get_type_hints(return_type)["results"])[0] - hint_type_list.append(hint_type) + try: + hint_type = get_args(get_type_hints(return_type)["results"])[0] + hint_type_list.append(hint_type) + except (KeyError, IndexError): + raise ValueError( # pylint: disable=W0707 + "Please ensure that the return type is an OBBject." + ) hint_type_list = cls.filter_hint_type_list(hint_type_list) |