Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/bot/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,16 @@ def _format_error_message(error_str: str) -> str:
)
else:
# Generic error handling
# Escape special markdown characters in error message
# Replace problematic chars that break Telegram markdown
safe_error = error_str.replace("_", "\\_").replace("*", "\\*").replace("`", "\\`").replace("[", "\\[")
# Truncate very long errors
if len(safe_error) > 200:
safe_error = safe_error[:200] + "..."

return (
f"❌ **Claude Code Error**\n\n"
f"Failed to process your request: {error_str}\n\n"
f"Failed to process your request: {safe_error}\n\n"
f"Please try again or contact the administrator if the problem persists."
)

Expand Down