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

πŸ§‘β€πŸ’» linting μœ„λ°˜μ‚¬ν•­ μˆ˜μ • #84

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

mingi3314
Copy link
Owner

@mingi3314 mingi3314 commented Feb 18, 2024


Generated summary (powered by Graphite)

TL;DR

This pull request improves error handling by chaining exceptions to provide more context when an error occurs. It also removes unnecessary __init__ methods from abstract base classes.

What changed

  1. In pyrb/controllers/api/main.py, the get_default_account function now raises an HTTPException with the original InitializationError attached for context.
  2. In pyrb/repositories/brokerages/base/fetcher.py, pyrb/repositories/brokerages/base/order_manager.py, and pyrb/repositories/brokerages/base/portfolio.py, the unnecessary __init__ methods were removed from the abstract base classes.
  3. In pyrb/repositories/brokerages/ebest/client.py, the _raise_for_status method now raises an Exception with the original HTTPError attached for context.
  4. In pyrb/repositories/brokerages/ebest/order_manager.py, the place_order method now raises an OrderPlacementError with the original HTTPError attached for context.

How to test

  1. Run the application and make a request to the get_default_account endpoint. If an InitializationError occurs, the response should now include the original error message.
  2. Test the abstract base classes to ensure they still function correctly without the __init__ methods.
  3. Make a request that triggers an HTTPError in the pyrb/repositories/brokerages/ebest/client.py file. The error message should now include the original error message.
  4. Make a request that triggers an HTTPError in the pyrb/repositories/brokerages/ebest/order_manager.py file. The error message should now include the original error message.

Why make this change

Chaining exceptions provides more context when an error occurs, which can help with debugging. Removing unnecessary __init__ methods from abstract base classes makes the code cleaner and easier to read.

Copy link
Owner Author

mingi3314 commented Feb 18, 2024

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link
Owner Author

mingi3314 commented Feb 18, 2024

Merge activity

  • Feb 18, 9:31 AM EST: @mingi3314 started a stack merge that includes this pull request via Graphite.
  • Feb 18, 9:32 AM EST: Graphite rebased this pull request as part of a merge.
  • Feb 18, 9:33 AM EST: @mingi3314 merged this pull request with Graphite.

Base automatically changed from 02-18-_ruff_integration to main February 18, 2024 14:31
@mingi3314 mingi3314 merged commit acc15b8 into main Feb 18, 2024
1 check passed
@mingi3314 mingi3314 deleted the 02-18-_linting_ branch February 18, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant