Handle exceptions from reactions_remove() calls (#119)

This is because I noticed this part of the code failing in the prod logs
This commit is contained in:
Mish 2025-11-20 13:06:22 +00:00 committed by GitHub
parent 7950126903
commit df7ab83cb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 10 deletions

View file

@ -1,5 +1,7 @@
import logging
from datetime import datetime
from slack_sdk.errors import SlackApiError
from slack_sdk.web.async_client import AsyncWebClient
from nephthys.utils.delete_thread import add_thread_to_delete_queue
@ -79,11 +81,16 @@ async def resolve(
timestamp=ts,
)
await client.reactions_remove(
channel=env.slack_help_channel,
name="thinking_face",
timestamp=ts,
)
try:
await client.reactions_remove(
channel=env.slack_help_channel,
name="thinking_face",
timestamp=ts,
)
except SlackApiError as e:
logging.error(
f"Failed to remove thinking reaction from ticket with ts {ts}: {e.response['error']}"
)
if await env.workspace_admin_available():
await add_thread_to_delete_queue(

View file

@ -1,5 +1,7 @@
import logging
from slack_sdk.errors import SlackApiError
from nephthys.macros.types import Macro
from nephthys.utils.env import env
from nephthys.utils.logging import send_heartbeat
@ -86,11 +88,16 @@ class Reopen(Macro):
data={"ticketTs": new_ticket_ts},
)
await env.slack_client.reactions_remove(
channel=env.slack_help_channel,
name="white_check_mark",
timestamp=ticket.msgTs,
)
try:
await env.slack_client.reactions_remove(
channel=env.slack_help_channel,
name="white_check_mark",
timestamp=ticket.msgTs,
)
except SlackApiError as e:
logging.error(
f"Failed to remove check reaction from ticket with ts {ticket.msgTs}: {e.response['error']}"
)
await env.slack_client.reactions_add(
channel=env.slack_help_channel,
name="thinking_face",