Commit e98eb92
fix: prevent Telegram media group exceptions from being silently swallowed (#7537)
* fix: prevent Telegram media group exceptions from being silently swallowed
process_media_group() is invoked by APScheduler via add_job(). If
convert_message() or handle_msg() raises (e.g. get_file() network
timeout, file download failure), APScheduler catches the exception
internally and only logs it through its own logger, which is often
not configured in AstrBot. The result is that the media group
silently disappears with no trace in the application logs.
Two changes:
- Wrap the body of process_media_group() in try/except so failures
are logged through AstrBot's own logger with full traceback.
- Register an EVENT_JOB_ERROR listener on the scheduler as a
safety net, so any future scheduled job that throws will also
surface in the logs.
Fixes #7512
* ruff format
---------
Co-authored-by: Soulter <905617992@qq.com>1 parent 3524551 commit e98eb92
1 file changed
Lines changed: 36 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| |||
695 | 705 | | |
696 | 706 | | |
697 | 707 | | |
698 | | - | |
699 | | - | |
700 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
701 | 712 | | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
707 | 718 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
714 | 725 | | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
720 | 731 | | |
721 | | - | |
722 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
723 | 738 | | |
724 | 739 | | |
725 | 740 | | |
| |||
0 commit comments