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:
parent
127cf320be
commit
b657892b3b
2 changed files with 8 additions and 2 deletions
|
@ -171,6 +171,8 @@ class Emotes(commands.Cog):
|
||||||
return (
|
return (
|
||||||
'An error occurred while creating the emote:\n'
|
'An error occurred while creating the emote:\n'
|
||||||
+ utils.format_http_exception(ex))
|
+ utils.format_http_exception(ex))
|
||||||
|
except errors.ImageResizeTimeoutError:
|
||||||
|
raise
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
return 'Error: retrieving the image took too long.'
|
return 'Error: retrieving the image took too long.'
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
import asyncio
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
from discord.ext import commands
|
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."""
|
"""Generic error with the bot. This can be used to catch all bot errors."""
|
||||||
pass
|
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):
|
class HTTPException(EmoteManagerError):
|
||||||
"""The server did not respond with an OK status code."""
|
"""The server did not respond with an OK status code."""
|
||||||
def __init__(self, status):
|
def __init__(self, status):
|
||||||
|
|
Loading…
Reference in a new issue