-
Notifications
You must be signed in to change notification settings - Fork 30
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
Send error message on command fail #17
Comments
Pulling this through would also simplify error handling situations like these discord-mods-bot/src/crates.rs Lines 46 to 62 in e4c0bfd
Right now, the code handles errors in two different ways simultaneously: some kinds of errors (e.g. network errors) are propagated up the chain and not posted, and other errors (crate not found) are posted. By having all errors be printed by default, the error propagation operator could be used for both: let krate = get_crate(&args)?;
args.msg.channel_id.send_message(&args.cx, |m| {
m.embed(|e| {
e.title(&krate.name)
.url(format!("https://crates.io/crates/{}", krate.id))
.description(&krate.description)
.field("version", &krate.version, true)
.field("downloads", &krate.downloads, true)
.timestamp(krate.updated.as_str())
});
m
})?; |
"Crate not found" is not an error, from our perspective. It's expected behaviour for command invocations to provide invalid input. The idea behind this issue is that unexpected errors would provide some feedback to the user instead of the bot being silent, so we should have a case in the central command handler for sending a generic "an error occurred, please contact..." message |
If a command encounters a non-fatal error, it should send the error as a response. Note, an invalid command should not be treated as an error.
The text was updated successfully, but these errors were encountered: