python-discord / bot

The community bot for the Python Discord community
https://pythondiscord.com
MIT License
1.34k stars 664 forks source link

Django API: HTTP error handling #127

Closed pydis-bot closed 5 years ago

pydis-bot commented 5 years ago

Originally posted by Johannes Christ:

In order to generalize our current error handling, the new API client raises HTTP errors straight to the commands. For simple cases that don't require specialized handling, we should use the command error handler in bot/cogs/events.py in order to provide a useful response.

I took an initial stab at it in https://gitlab.com/python-discord/projects/bot/merge_requests/67, which you can look at for reference, but I did not yet fully figure it out.

You will either have to fire requests against my API instance or set up your own instance of the website: see the setup documentation on the Django branch for details.

For documentation on the command handler, see https://discordpy.readthedocs.io/en/rewrite/ext/commands/api.html#discord.on_command_error.

If you have any questions, please ask.

Please leave a comment if you start to work on this issue.

Part of #67.

MarkKoz commented 5 years ago

Implemented in #392