Skip to content

Commit

Permalink
Refactor, better error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed May 22, 2024
1 parent 88f4ed7 commit 11a88ce
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 212 deletions.
6 changes: 3 additions & 3 deletions app/bolt_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def prepare_and_share_thread_summary(
view=build_summarize_timeout_error_modal(),
)
except Exception as e:
logger.error(f"Failed to share a thread summary: {e}")
logger.exception(f"Failed to share a thread summary: {e}")
client.views_update(
view_id=payload["id"],
view=build_summarize_error_modal(e),
Expand Down Expand Up @@ -709,7 +709,7 @@ def send_proofreading_result_in_dm(
),
)
except Exception as e:
logger.error(f"Failed to send a DM: {e}")
logger.exception(f"Failed to send a DM: {e}")


#
Expand Down Expand Up @@ -760,7 +760,7 @@ def display_chat_from_scratch_result(
view=build_from_scratch_timeout_modal(text),
)
except Exception as e:
logger.error(f"Failed to share a thread summary: {e}")
logger.exception(f"Failed to share a thread summary: {e}")
client.views_update(
view_id=payload["id"],
view=build_from_scratch_error_modal(text=text, e=e),
Expand Down
3 changes: 2 additions & 1 deletion app/slack_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def build_thread_replies_as_combined_text(
if user == context.bot_user_id: # Skip replies by this app
continue
if user is None:
user = client.bots_info(bot=reply.get("bot_id"))["bot"]["user_id"]
bot_response = client.bots_info(bot=reply.get("bot_id"))
user = bot_response.get("bot", {}).get("user_id")
if user is None or user == context.bot_user_id:
continue
text = slack_to_markdown("".join(reply["text"].splitlines()))
Expand Down
Loading

0 comments on commit 11a88ce

Please sign in to comment.