From 10dddfd893680d5aa230ffab7ff6b0ed1c8f3f8b Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 13 May 2024 20:34:55 +0200 Subject: [PATCH] [BugFix] - Explicit error message when return type is not an OBBject (#6394) * Send an explicit message when return type isn't an OBBject * Update package_builder.py Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * lint --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> --- openbb_platform/core/openbb_core/app/static/package_builder.py | 2 ++ 1 file changed, 2 insertions(+) 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 5db17483a191..11fcc5766b0a 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder.py @@ -319,6 +319,8 @@ def get_function_hint_type_list(cls, func: Callable) -> List[Type]: hint_type_list.append(parameter.annotation) if return_type: + if not issubclass(return_type, OBBject): + raise ValueError("Return type must be an OBBject.") hint_type = get_args(get_type_hints(return_type)["results"])[0] hint_type_list.append(hint_type)