fix: chain the KeyError->ValueError normalization with from error (dpylogger-10)
The settings-lookup KeyError->ValueError raise was bare, unlike the three sibling discord-exception normalization sites which all chain via "from error". __context__ still linked implicitly at runtime, but this makes the traceback style consistent (flake8-B904) across every normalization site. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -149,8 +149,8 @@ class DPYLogger:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
channel_id = self.bot.settings[guild.id]["channels"]["logs"]
|
channel_id = self.bot.settings[guild.id]["channels"]["logs"]
|
||||||
except KeyError:
|
except KeyError as error:
|
||||||
raise ValueError(f"[dpy_logger] no log channel configured for guild {guild.id}")
|
raise ValueError(f"[dpy_logger] no log channel configured for guild {guild.id}") from error
|
||||||
try:
|
try:
|
||||||
channel = await guild.fetch_channel(channel_id)
|
channel = await guild.fetch_channel(channel_id)
|
||||||
except (discord.HTTPException, discord.ClientException) as error:
|
except (discord.HTTPException, discord.ClientException) as error:
|
||||||
|
|||||||
Reference in New Issue
Block a user