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

Update exceptions.py #1364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update exceptions.py #1364

wants to merge 1 commit into from

Conversation

PJV0043
Copy link

@PJV0043 PJV0043 commented Oct 11, 2023

In this improved version, messages are centrally located in the ERROR_MESSAGES dictionary, making future changes easier. The use of the message key in the specific exceptions allows for code to be less redundant and more unified in its structure.

In this improved version, messages are centrally located in the ERROR_MESSAGES dictionary, making future changes easier. The use of the message key in the specific exceptions allows for code to be less redundant and more unified in its structure.
Comment on lines +4 to +12
ERROR_MESSAGES = {
"invalid_json": "Invalid JSON error message from Binance: {}",
"unknown_symbol": "Unknown symbol {}",
"inactive_symbol": "Attempting to trade an inactive symbol {}",
"min_amount": "Amount must be a multiple of {}",
"min_price": "Price must be at least {}",
"min_total": "Total must be at least {}",
"not_implemented": "Not implemented: {}"
}

Choose a reason for hiding this comment

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

Hello, seems to me that you "could" decouple this. Comes to my mind that can create a "constant" file and specify in there all the constants (including those error messages) required by this service.

If you are not happy with this you are free to solve my comment / review.

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.

2 participants