From 433e966860bffab09955dcd7e2551ac935c2b6fa Mon Sep 17 00:00:00 2001 From: guopengfa Date: Sun, 18 Jan 2026 23:01:57 +0800 Subject: [PATCH] capture signal error. --- backend_api_python/app/services/signal_notifier.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend_api_python/app/services/signal_notifier.py b/backend_api_python/app/services/signal_notifier.py index ce2c8b3..8f41753 100644 --- a/backend_api_python/app/services/signal_notifier.py +++ b/backend_api_python/app/services/signal_notifier.py @@ -24,6 +24,7 @@ import json import os import smtplib import time +import traceback from datetime import datetime, timezone from email.message import EmailMessage from typing import Any, Dict, List, Optional, Tuple @@ -482,6 +483,7 @@ class SignalNotifier: return True, "" except Exception as e: logger.warning(f"browser notify persist failed: {e}") + logger.error('browser.error', traceback=traceback.format_exc()) return False, str(e) def _notify_webhook( @@ -571,6 +573,7 @@ class SignalNotifier: return False, f"http_{resp2.status_code}:{(resp2.text or '')[:300]}" return False, f"http_{resp.status_code}:{(resp.text or '')[:300]}" except Exception as e: + logger.error('webhook.error', traceback=traceback.format_exc()) return False, str(e) def _notify_discord(self, *, url: str, payload: Dict[str, Any], fallback_text: str) -> Tuple[bool, str]: @@ -646,6 +649,7 @@ class SignalNotifier: pass return False, f"http_{resp.status_code}:{(resp.text or '')[:300]}" except Exception as e: + logger.error('discord.error', traceback=traceback.format_exc()) return False, str(e) def _notify_telegram( @@ -680,6 +684,7 @@ class SignalNotifier: return True, "" return False, f"http_{resp.status_code}:{(resp.text or '')[:300]}" except Exception as e: + logger.error('telegram.error', traceback=traceback.format_exc()) return False, str(e) def _notify_email(self, *, to_email: str, subject: str, body_text: str, body_html: str = "") -> Tuple[bool, str]: @@ -718,6 +723,7 @@ class SignalNotifier: server.send_message(msg) return True, "" except Exception as e: + logger.error('email.error', traceback=traceback.format_exc()) return False, str(e) def _notify_phone(self, *, to_phone: str, body: str) -> Tuple[bool, str]: @@ -734,6 +740,7 @@ class SignalNotifier: return True, "" return False, f"http_{resp.status_code}:{(resp.text or '')[:300]}" except Exception as e: + logger.error('phone.error', traceback=traceback.format_exc()) return False, str(e)