-
Notifications
You must be signed in to change notification settings - Fork 1
feat: enhance error logging with HTML formatting and add HTML escapin… #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughSwitches Telegram error logging from Markdown/plaintext to HTML formatting, adds HTML escaping utility, constructs HTML message with user/amount/memo/invoice and detail blocks, sends via a new HTML-specific path with parse mode and thread/reply support, and introduces a fallback to plain text if HTML send fails. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor App as App
participant EL as ErrorLogger
participant Utils as utils.EscapeHTML
participant TG as Telegram API
App->>EL: LogPaymentError(err, user, amount, memo, invoice)
EL->>Utils: EscapeHTML(fields)
Utils-->>EL: escaped strings
EL->>EL: Build HTML message (user, amount, memo, invoice, details)
EL->>TG: sendMessage(chat, msg, parse_mode=HTML)
alt HTML send succeeds
TG-->>EL: ok
EL-->>App: done
else HTML send fails (e.g., parse error)
EL->>EL: Fallback to plaintext
EL->>TG: sendMessage(chat, plain_text, parse_mode=none)
TG-->>EL: ok or error
EL-->>App: done
end
note over EL,TG: Existing non-payment logs unchanged (not shown)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
…g utility
PR Type
Enhancement
Description
Migrated payment error logging from MarkdownV2 to HTML formatting
Added HTML escaping utility function for safe Telegram message rendering
Enhanced error messages with spoiler tags and blockquote formatting
Introduced dedicated
sendToTelegramHTMLmethod for HTML message deliveryDiagram Walkthrough
File Walkthrough
error_logger.go
Convert payment error logging to HTML formatinternal/telegram/error_logger.go
LogPaymentErrorsendToTelegramHTMLmethod with HTML parse modehtml.go
Add HTML escaping utility functioninternal/utils/html.go
EscapeHTMLfunction to sanitize special HTML characters&,<,>,", and'for safe Telegram renderingSummary by CodeRabbit