Skip to content

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