ability to handle type errors and other checks with appropriate messages in commandsnext
See original GitHub issueThis is related to the commandsnext module.
I would like my bot to return an appropriate error message to the user when checks fail, such as wrong argument types, Cooldowns, etc.
For example:
[Command("foo")]
public async Task Foo(CommandContext ctx, int bar)
If a user says !foo someString
, i’d like to be able to tell the user the usage of the !foo command. Right now if a check fails, then the bot fails silently and my users have no idea what’s going on.
The best workaround I can figure is to somehow catch it in the error delegate, and try and figure out what happened based on the generic exception, which is very much not ideal.
Perhaps checks could be paired with failure handlers that we can set.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (9 by maintainers)
Top Results From Across the Web
How to handle errors with grace: failing silently is not an ...
Consolidate errors. It's fine if you care about different kinds of errors which need to be handled differently, but do your users a...
Read more >Should one check for every little error in C?
In general, code should deal with exceptional conditions wherever it is appropriate. Yes, this is a vague statement.
Read more >c++ - Theory on error handling?
The types of errors in third party libraries are the same types of errors that occur in application code. Errors should be handled...
Read more >2.5 Error Handling and Generation | Mastering Software ...
Proper error handling is an essential tool for any software developer so that you can design programs that are error tolerant. Creating clear...
Read more >What is Exception Handling? - SearchSoftwareQuality
Exception handling is the process of responding to unwanted or unexpected events when a computer program runs. Exception handling deals with these events...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No. No. No. And, once again, no. Communication is not anywhere near the area of what a check should do. That’s what the event handlers should be doing.
A check should be doing a simple validation. Nothing more.
The problem outlined in here stems from complete lack of knowledge about how event-driven programming and polymorphism work, as well as not reading the docs.
The exception gives you all the details, including the failed checks and the execution context. It’s all listed in the docs and provided examples.
Facts are not insults.