Skip to content

Commit

Permalink
fix(case): log warning instead of throw exception (#5604)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Dec 11, 2024
1 parent 6b46e96 commit 820c3da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/dispatch/case/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ def send_case_welcome_participant_message(
"assignee_fullname": case.assignee.individual.name,
"assignee_team": case.assignee.team,
"assignee_weblink": case.assignee.individual.weblink,
"reporter_fullname": case.reporter.individual.name,
"reporter_team": case.reporter.team,
"reporter_weblink": case.reporter.individual.weblink,
"reporter_fullname": case.reporter.individual.name if case.reporter else None,
"reporter_team": case.reporter.team if case.reporter else None,
"reporter_weblink": case.reporter.individual.weblink if case.reporter else None,
"document_weblink": resolve_attr(case, "case_document.weblink"),
"storage_weblink": resolve_attr(case, "storage.weblink"),
"ticket_weblink": resolve_attr(case, "ticket.weblink"),
Expand Down
10 changes: 8 additions & 2 deletions src/dispatch/conversation/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ def create_case_conversation(
# Do not overwrite a case conversation with one of the same type (thread, channel)
if case.conversation:
if case.has_channel:
raise RuntimeError("Case already has a dedicated channel conversation.")
log.warning(
f"Trying to create case conversation but case {case.id} already has a dedicated channel conversation."
)
return
if case.has_thread and not case.dedicated_channel:
raise RuntimeError("Case already has a thread conversation.")
log.warning(
"Trying to create case conversation but case {case.id} already has a thread conversation."
)
return

# This case is a thread version, we send a new messaged (threaded) to the conversation target
# for the configured case type
Expand Down

0 comments on commit 820c3da

Please sign in to comment.