1
0
Fork 0
mirror of https://github.com/uhIgnacio/EmoteManager.git synced 2024-08-15 02:23:13 +00:00

fix errors when timing out while resizing

This commit is contained in:
Benjamin Mintz 2019-06-10 23:42:44 +00:00
parent 127cf320be
commit b657892b3b
2 changed files with 8 additions and 2 deletions

View file

@ -171,6 +171,8 @@ class Emotes(commands.Cog):
return (
'An error occurred while creating the emote:\n'
+ utils.format_http_exception(ex))
except errors.ImageResizeTimeoutError:
raise
except asyncio.TimeoutError:
return 'Error: retrieving the image took too long.'
except ValueError:

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# encoding: utf-8
import asyncio
from discord.ext import commands
@ -19,6 +18,11 @@ class EmoteManagerError(commands.CommandError):
"""Generic error with the bot. This can be used to catch all bot errors."""
pass
class ImageResizeTimeoutError(EmoteManagerError, asyncio.TimeoutError):
"""Resizing the image took too long."""
def __init__(self):
super().__init__('Error: resizing the image took too long.')
class HTTPException(EmoteManagerError):
"""The server did not respond with an OK status code."""
def __init__(self, status):