bot icon indicating copy to clipboard operation
bot copied to clipboard

Consistent Error Responses

Open pydis-bot opened this issue 7 years ago • 12 comments
trafficstars

Some errors use plain messages (e.g. general error handlers and moderation cogs) while others use embeds, sometimes even including humorous replies (e.g. reminders and clean cogs). Errors don't necessarily refer to CommandError here - it could be any error that is being handled, even ones that aren't exceptions.

Embeds have more formatting options, allow room for those humorous replies, and are more prominent in the sense that 1. bigger = more noticeable and 2. can't be confused for a regular user's message. On the other hand, plain messages have less clutter around them and are simpler to create in code (may be a moot point if a generic utility function is added to create the embeds).

  • Should the plain/embed be mutually exclusive? In other words, should everything only use one of them to stay consistent, or should some things be allowed use the other? If not, which should be used by what?
  • What style(s) should be used to stay consistent? Should the humorous replies always be used? Should plain messages always be prefixed by emojis?
  • Can and should a generic function be written to create these error messages? #674 is doing that for embeds.

All the areas where errors are being handled should be identified so that it is clear what changes need to be made and where.

Originally posted by Kingsley McDonald:

many error responses in the Moderation cog aren't sent as an embed. instead, the messages are sent with a very simple (and ugly) :x:. all occurrences of this should be changed to be consistent with the rest of the bot's responses.

pydis-bot avatar Nov 17 '18 12:11 pydis-bot

Comment from Leon Sandøy:

mentioned in merge request !47

pydis-bot avatar Nov 17 '18 12:11 pydis-bot

It seems we are moving away from embeds in favour of plain messages because they have less clutter. The downside is that they are no longer as prominent as they would be if they were embeds.

Which direction to take is still open for discussion.

MarkKoz avatar Aug 06 '19 00:08 MarkKoz

Some additional context:

The default error handler currently does not use embeds. However, some commands/cogs have their own error handlers which do use embeds. For example: utils and snekbox. These embeds also take a random error message to display in the title.

MarkKoz avatar Sep 14 '19 19:09 MarkKoz

Closing this in favour of #131

scragly avatar Nov 15 '19 16:11 scragly

I think it's best to keep this a separate issue from #131 as this issue is concerned with formatting of errors in all cogs while the other is concerned with coverage of errors in the main error handler.

MarkKoz avatar Feb 17 '20 03:02 MarkKoz

In #1058, we're changing the error handler so that all errors will return an embed. It looks like this:

image

This isn't perfect, but it adds some sorely needed sanity and looks slightly more professional. However, we should probably open a pull request that will turn these two embeds into one.

lemonsaurus avatar Jul 29 '20 21:07 lemonsaurus

#1058 has been merged.

However, we should probably open a pull request that will turn these two embeds into one.

I'm not sure if it would look much better as one embed, since it may be a bit messy. Having this as 2 different embeds separates the subjects into an "error" and "help" field, may not be the best when put together.

Thoughts, @MarkKoz?

Xithrius avatar Jan 11 '21 17:01 Xithrius

Hard to say without seeing what it'd look like. It could probably get away with only showing the usage code block from the help embed - the aliases and descriptions can be omitted.

In any case, there are some situations where showing the help isn't even useful. The screenshot above perfectly illustrates that. The help message is more useful when an argument is missing or if the error message is too generic (like an invalid type).

This is just one aspect of the issue. I believe there are still places where commands directly output error messages rather than raising exceptions. They inconsistently use embeds or plain messages, and the formats of those may also be inconsistent.

MarkKoz avatar Jan 11 '21 21:01 MarkKoz

I read back the whole issue, starting from the beginning. I believe most of the times showing one embed with the usage (like in Sir Lancebot's error handler.) is more consistent than the current one (Showing two embeds) But we can make specific cases for specific errors, like not showing the usage just the error message!(Although, at that point, I don't think it's a huge problem that it shows the usage, even if it seems it is not helpful.) (I'd be interested in helping implement this)

D0rs4n avatar Aug 04 '21 19:08 D0rs4n

  1. Regarding the OP, I don't think it's necessary for all error messages to be in the same format. The bot is massive and is comprised of extensions, some of which have their own unique aspects. For example, the default error message for a bad or missing argument is handled by the error handler and is posted as an embed, but for some moderation commands there might be errors which are out of the moderator's control (e.g the member left the server). In the latter case it's more useful to have a concise error message in plaintext to explain what happened, instead of dumping the help embed, which is annoying especially when it happens in a public channel. To summarize, I think it's ok for different features to display errors in ways that are appropriate to them.
  2. Another point in the OP is whether all plaintext errors should have emojis. I think they're nice visual cues. Not sure if I would bother enforcing it, but I take care to add them when writing plaintext errors.
  3. I think we should merge the error and the help embed like in sir-lancebot. This also simplifies a possible migration of the error handler to bot-core. Most people here seem to be in favor, so unless there are strong opinions against let's stick with this direction from now on.

mbaruh avatar Apr 19 '22 12:04 mbaruh

One option for merging the embeds now is something like this with buttons, where the "Help" button could send an ephemeral message with the contents of the help command. image

wookie184 avatar Mar 04 '23 20:03 wookie184

Looks good. Let's just go for it.

mbaruh avatar Mar 05 '23 07:03 mbaruh