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

feat/error handler #77

Merged
merged 14 commits into from
Sep 29, 2021
Merged

feat/error handler #77

merged 14 commits into from
Sep 29, 2021

Conversation

onerandomusername
Copy link
Member

  • feat: add initial error handler
  • add some CheckFailure handling support
  • fix: implement remaining UserInputErrors
  • fix: title regex
  • fix: add concurrency errors and cooldown error support
  • fix: don't log CommandNotFound errors unless in a dev mode
  • fix: handle bot missing permissions

@codecov
Copy link

codecov bot commented Sep 25, 2021

Codecov Report

Merging #77 (144b008) into main (b5ab21f) will decrease coverage by 5.32%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
- Coverage   38.62%   33.29%   -5.33%     
==========================================
  Files          16       17       +1     
  Lines         769      892     +123     
  Branches      105      132      +27     
==========================================
  Hits          297      297              
- Misses        459      582     +123     
  Partials       13       13              
Impacted Files Coverage Δ
modmail/extensions/utils/error_handler.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5ab21f...144b008. Read the comment docs.

@onerandomusername onerandomusername added the a: bot Catch all for issues regarding the bot label Sep 25, 2021
@onerandomusername onerandomusername added this to In progress in v1.0.0 via automation Sep 25, 2021
@onerandomusername onerandomusername added p: normal Normal Priority s: needs review Ready for review and merge t: feature Relating to the functionality of the application. labels Sep 25, 2021
Copy link
Contributor

@dawnofmidnight dawnofmidnight left a comment

Choose a reason for hiding this comment

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

This looks pretty good, although I can't test at the moment because I'm not on my usual dev environment. One side question: should "dm" or "dming" be capitalized?

modmail/extensions/utils/error_handler.py Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
v1.0.0 automation moved this from In progress to Review in progress Sep 25, 2021
modmail/extensions/utils/error_handler.py Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
@onerandomusername
Copy link
Member Author

There is a fundamental issue with the botmissingpermissions error handling. In almost all send message cases, the bot will make a second case which will 100% fail.

The bot should check its cache or request the channel perms to see if it has send message perms. If it does, should also check for embed image permissions, and send a standard message of content if that fails.

if that is not a valid permission, the bot should see if it has add_reaction permissions and maybe add a :x: if it can.

modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
modmail/extensions/utils/error_handler.py Outdated Show resolved Hide resolved
@onerandomusername
Copy link
Member Author

There is a fundamental issue with the botmissingpermissions error handling. In almost all send message cases, the bot will make a second case which will 100% fail.

The bot should check its cache or request the channel perms to see if it has send message perms. If it does, should also check for embed image permissions, and send a standard message of content if that fails.

if that is not a valid permission, the bot should see if it has add_reaction permissions and maybe add a :x: if it can.

This is implemented in 7f19996

v1.0.0 automation moved this from Review in progress to Reviewer approved Sep 29, 2021
@bast0006 bast0006 merged commit ebc2f94 into main Sep 29, 2021
@bast0006 bast0006 deleted the feat/error-handler branch September 29, 2021 07:23
v1.0.0 automation moved this from Reviewer approved to Done Sep 29, 2021
@Shivansh-007 Shivansh-007 mentioned this pull request Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: bot Catch all for issues regarding the bot p: normal Normal Priority s: needs review Ready for review and merge t: feature Relating to the functionality of the application.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants