diff options
| author | 2018-07-25 14:42:32 -0400 | |
|---|---|---|
| committer | 2018-07-25 14:42:32 -0400 | |
| commit | f1c42a99324fad332ed9e74253b8be8d3c8dc2e4 (patch) | |
| tree | 882197727dc1944e2fbc9219e7b152ec87b14526 | |
| parent | Fix documentation issues (diff) | |
Use less generic Exceptions when possible
| -rw-r--r-- | bot/cogs/moderation.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py index c8d2f59cf..0483ab716 100644 --- a/bot/cogs/moderation.py +++ b/bot/cogs/moderation.py @@ -3,6 +3,7 @@ import datetime import logging from typing import Dict +from aiohttp import ClientError from discord import Colour, Embed, Guild, Member, Object, User from discord.ext.commands import Bot, Context, command @@ -63,7 +64,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -100,7 +101,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -139,7 +140,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -179,7 +180,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -224,7 +225,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -271,7 +272,7 @@ class Moderation: "actor_id": str(ctx.message.author.id) } ) - except Exception: + except ClientError: log.exception("There was an error adding an infraction.") await ctx.send(":x: There was an error adding the infraction.") return @@ -473,7 +474,7 @@ class Moderation: headers=self.headers ) infraction_list = await response.json() - except Exception: + except ClientError: log.exception("There was an error fetching infractions.") await ctx.send(":x: There was an error fetching infraction.") return @@ -496,7 +497,7 @@ class Moderation: params={"search": arg} ) infraction_list = await response.json() - except Exception: + except ClientError: log.exception("There was an error fetching infractions.") await ctx.send(":x: There was an error fetching infraction.") return |