Skip to content

fix: send full error as log file when message exceeds Telegram limit - #86

Merged
Nachtalb merged 1 commit into
masterfrom
fix/error-log-attachment
Feb 26, 2026
Merged

fix: send full error as log file when message exceeds Telegram limit#86
Nachtalb merged 1 commit into
masterfrom
fix/error-log-attachment

Conversation

@Nachtalb

Copy link
Copy Markdown
Owner

Problem

When an error message (e.g. a long traceback) exceeded Telegram's 4096-char message limit, the old code silently truncated the traceback inside format() β€” making it impossible to diagnose the actual root cause.

Solution

  • Move length handling out of format() into emit()
  • If message fits in 4096 chars β†’ send as before
  • If too long β†’ send truncated message (≀3900 chars) with a note, then send the full plain-text error as a .log file attachment (named error_<timestamp>_<level>.log)
  • format() no longer silently truncates β€” it wraps tracebacks in <pre> without cutting them

@Nachtalb
Nachtalb force-pushed the fix/error-log-attachment branch 2 times, most recently from 347a3f8 to e7b7cf9 Compare February 26, 2026 15:19
When a logged error message exceeds Telegram's 4096-char limit, send a
truncated message followed by the full plain-text error as a .log file
attachment. Removes the old silent in-format truncation in favour of
explicit overflow handling in emit().
@Nachtalb
Nachtalb force-pushed the fix/error-log-attachment branch from e7b7cf9 to 0f42549 Compare February 26, 2026 15:20
@Nachtalb
Nachtalb merged commit 15e87e0 into master Feb 26, 2026
4 checks passed
@Nachtalb
Nachtalb deleted the fix/error-log-attachment branch February 26, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant