-
Notifications
You must be signed in to change notification settings - Fork 20
Add error messages when somethings goes wrong #27
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
base: development
Are you sure you want to change the base?
Conversation
| } else { | ||
| this.setAlert(true, `The bot was unable to sell. ${error.toString()}.`, 'danger'); | ||
| this.setSellEnabled(false); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add return statement to if & remove else block
| checkAPIKeys = () => { | ||
| const { key, secret } = this.props.opts.binance; | ||
| if (!key || !secret) { | ||
| this.setAlert(true, 'API key/secret not defined. Take a look at the readme on how to add these and restart the server.', 'danger'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setAlert(
true,
'API key/secret not defined. Take a look at the readme on how to add these and restart the server.',
'danger'
);| } | ||
| }; | ||
|
|
||
| setAlert = (open, message, color) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This micro API is vague and unnecessary. You're better of without it, really
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When removing this method, there will be much duplicated code to implement the same functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No there won't be since you're essentially just setting the state.
You could replace a call to setAlert like this:
setAlert(true, 'Foobar', 'warning');with this:
this.setState({
alert: {
open: true,
message: 'Foobar',
color: 'warning',
},
});This is longer but much, much much more clear
No description provided.