Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Add Exception Handling For Unauthorized API Key Error. #6800

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Oct 18, 2024

  1. Why?:

    • This error is not consistently returned by providers and can be different for various endpoints within the same provider. It can result in a message being hidden as an unexpected error.

Example:

image

  1. What?:

    • Creates a new Exception class, UnauthorizedError, in: openbb_core.provider.utils.errors
    • Adds the new error to the exception handlers as HTTP status code 502.
    • The error accepts a 'provider_name' argument that will inject itself into the default message, if no message is provided.
    • Refactors Tiingo, Benzinga, and Biztoc to handle these types of errors by adding a response_callback function to the provider extension's utilities.
    • Updates some Intrinio endpoints and the response_callback function.
    • Updates the FMP response_callback function.
    • Includes the Exception type and message when it is an unexpected error.
    • Updates Tiingo historical price endpoints to allow intraday intervals.
  2. Impact:

    • Improved error handling.

    • Enhances Tiingo price data with historical intraday intervals that can be arbitrarily defined - i.e, 7m.

    • UnauthorizedError:

Screenshot 2024-10-17 at 9 32 46 PM

image

  • Unexpected error:

image

  1. Testing Done:

    • Described above.
  2. Reviewer Notes:

    • This is not scoped to refactoring all providers for this error specifically, it's a good start though.

@deeleeramone deeleeramone added bug Fix bug platform OpenBB Platform v4 PRs for v4 labels Oct 18, 2024
Copy link
Contributor

@piiq piiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this UI is annoying. I actually need to add a separate comment to have all inline comments appear. Sorry

openbb_platform/core/openbb_core/provider/utils/errors.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug platform OpenBB Platform v4 PRs for v4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] tiingo and biztoc providers for world news in SDK and openbb-cli not working
2 participants