refactor: drop the pass-through try/excepts around create and delete
T3-21: except discord.HTTPException: raise did nothing; the exceptions already propagate unwrapped. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
1 parent
7adb8dc386
commit
5681efe1e0
1 file changed
-9
@@ -172,22 +172,13 @@ class DPYAppEmojis:
|
|||||||
|
|
||||||
for name in to_create:
|
for name in to_create:
|
||||||
image = await asyncio.to_thread(_read_file, desired[name])
|
image = await asyncio.to_thread(_read_file, desired[name])
|
||||||
try:
|
|
||||||
emoji = await self._client.create_application_emoji(name=name, image=image)
|
emoji = await self._client.create_application_emoji(name=name, image=image)
|
||||||
except discord.HTTPException:
|
|
||||||
# raise XOR log: this re-raises, so the exception carries the failure to the
|
|
||||||
# caller (who decides fatal-vs-routine) - no error log here would double-report.
|
|
||||||
raise
|
|
||||||
current[name] = emoji
|
current[name] = emoji
|
||||||
result.created.append(name)
|
result.created.append(name)
|
||||||
|
|
||||||
for name, emoji in list(existing.items()):
|
for name, emoji in list(existing.items()):
|
||||||
if name not in desired:
|
if name not in desired:
|
||||||
try:
|
|
||||||
await emoji.delete()
|
await emoji.delete()
|
||||||
except discord.HTTPException:
|
|
||||||
# raise XOR log: re-raises, so the exception is the signal - no log here.
|
|
||||||
raise
|
|
||||||
current.pop(name, None)
|
current.pop(name, None)
|
||||||
result.deleted.append(name)
|
result.deleted.append(name)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user