Mattermost-server: [Help Wanted] [MM-13061] Improve error handling of slash commands

Created on 21 Nov 2018  路  2Comments  路  Source: mattermost/mattermost-server

If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.


Notes: Jira ticket

The function app.HandleCommandResponse currently ignores errors created during the Post creation. With the PR https://github.com/mattermost/mattermost-server/pull/9836 we copied the current behavior, but it somewhat complicates it, since the error could occur for any of the N messages that could be created as part of the webhook response.

The cases where this can happen is:

  • The post type used has a system_ prefix
  • The app.CreatePost method returns some error

In case this happens for any of the posts, the error will be dropped (aside from the system console) and nothing displayed to the user. If we stop to parse any of the remaining posts once we hit the first error, it would cause a bad UX as well. Returning an error and a response is currently not a supported behavior in chain of HandleCommandResponse upwards.

For this ticket, implement a way to return error responses to clients when an error, like the ones above, occur during slash command response handling.

If you have any questions or would like feedback, feel free to ask in the Developer Toolkit channel on our Mattermost community instance.


Additional PM notes for two additional cases to consider after talking to Michael (mickmister) on GitHub.

1 - Post /post <channel> <message> where <channel> doesn't exist.
Observed: Error message: Command with a trigger of 'post' returned response 500 Internal Server Error
Expected: Error message (consistent with /invite command): Could not find the channel {{.Channel}}. Please use the [channel handle](https://about.mattermost.com/default-channel-handle-documentation) to identify channels.

2 - Post /post <channel> <message> where <channel> exists but is a private channel you don't have permissions.
Observed: No response.
Expected: Error message (consistent with /invite command): Could not find the channel {{.Channel}}. Please use the [channel handle](https://about.mattermost.com/default-channel-handle-documentation) to identify channels.

Medium TecGo

Most helpful comment

I'd like to work on this!

All 2 comments

I'd like to work on this!

Was this page helpful?
0 / 5 - 0 ratings