[Enhancement] Improve provider fallback message (#6507)

* feat: improve fallback message

* fix: non blocking request

* timeout

* fix: undo request

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
This commit is contained in:
montezdesousa
2024-06-20 17:43:32 +01:00
committed by GitHub
parent 826cbcdf9d
commit ea61e6d5e7
2 changed files with 3 additions and 6 deletions

View File

@@ -72,11 +72,8 @@ class Container:
if result is False:
tries.append((p, "missing credentials"))
else:
tries.append((p, "not found"))
tries.append((p, f"not installed, please install openbb-{p}"))
msg = "\n ".join([f"* '{pair[0]}' -> {pair[1]}" for pair in tries])
raise OpenBBError(
f"Provider fallback failed, please specify one of the available providers or update credentials.\n"
f"[Providers]\n {msg}"
)
raise OpenBBError(f"Provider fallback failed.\n" f"[Providers]\n {msg}")
return choice

View File

@@ -88,7 +88,7 @@ def test_container__check_credentials(container):
("provider_1", "provider_2"),
OpenBBError,
escape(
"Provider fallback failed, please specify one of the available providers or update credentials."
"Provider fallback failed."
"\n[Providers]\n * 'x' -> not found\n * 'y' -> not found\n * 'z' -> not found"
),
),