From 339c103fcebb323ba7bd7f8c6f851e97d771b904 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Wed, 20 Apr 2022 13:33:07 -0600 Subject: [PATCH] Catch reddit redirect errors --- jarvis/cogs/reddit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jarvis/cogs/reddit.py b/jarvis/cogs/reddit.py index 8838a9f..2b2f024 100644 --- a/jarvis/cogs/reddit.py +++ b/jarvis/cogs/reddit.py @@ -3,7 +3,7 @@ import asyncio import logging from asyncpraw import Reddit -from asyncprawcore.exceptions import Forbidden, NotFound +from asyncprawcore.exceptions import Forbidden, NotFound, Redirect from dis_snek import InteractionContext, Permissions, Scale, Snake from dis_snek.client.utils.misc_utils import get from dis_snek.models.discord.channel import ChannelTypes, GuildText @@ -64,7 +64,7 @@ class RedditCog(Scale): try: subreddit = await self.api.subreddit(name) await subreddit.load() - except (NotFound, Forbidden) as e: + except (NotFound, Forbidden, Redirect) as e: self.logger.debug(f"Subreddit {name} raised {e.__class__.__name__} on add") await ctx.send("Subreddit may be private, quarantined, or nonexistent.", ephemeral=True) return