Use error_embed for errors, tidy code, show cmd signature for user errors.#332
Merged
Conversation
sco1
approved these changes
Dec 15, 2019
ikuyarihS
approved these changes
Dec 15, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Closes #307
Description of Changes
error_embedclassmethod to build error embeds consistentlyerror_embedmethod for any user responseslog.exceptioninstead of usinglogging.warninglog.exceptionby passingexc_infomath.ceilonretry_afterinstead of within f-string to be cleanerUserInputError,BadArgument)Reasoning
CRLF to LF
Our projects use LF line separators and it seems sometime in the past CRLF was accidentally committed. This was brought back inline for consistency.
Error message consistency
Some errors shown an embed, others didn't. This brings everything back together to be the same and to make use of the random error titles with
ERROR_REPLIESused by default andNEGATIVE_REPLIESable to be used for errors caused by permissions/checks/cooldowns.Error specific logs
If all are logged, there's really no need for each to have one.
Using
log.exceptionwith full tracebackPreviously errors looked like this during development:
To be honest, it's pretty useless. It doesn't tell us where the error is located, on what line and what lead up to the event.
With the changes we have instead:
Which is far more useful during development or even when just needing to look back on log output generally for unhandled cases.
Use math.ceil on
retry_afterDoing so reduced the code from:
to the alternative which shortens the var names and removes the unnecessary int cast:
Show command signature on user invoke error
The current output when a command is used incorrectly is:

This isn't too useful to new users, as then they'd likely have to manually use
.help commandnamewhich is just another step, or they'd keep guessing.Instead this was changed to show the proper usage:

Did you:
pipenv run lint)