fix: refine push error matching and maximize webhook logging for debugging
All checks were successful
Build MIPS Binary / build (push) Successful in 1m50s

This commit is contained in:
spinline
2026-02-13 12:51:46 +03:00
parent 3ad8424d17
commit 795eef4bda

View File

@@ -201,11 +201,18 @@ pub async fn send_push_notification(
} }
} }
Err(e) => { Err(e) => {
let err_msg = format!("{:?}", e); let err_debug = format!("{:?}", e);
tracing::error!("Failed to build push message for {}: {}", subscription.endpoint, err_msg); let err_display = format!("{}", e);
tracing::error!("Failed to build push message for {}: (Debug: {}) (Display: {})", subscription.endpoint, err_debug, err_display);
// Broaden error matching to catch various encryption and auth failures // Broaden error matching to catch various encryption and auth failures
if err_msg.contains("encrypting") || err_msg.contains("Vapid") || err_msg.contains("Unauthorized") { let is_critical_error = err_debug.to_lowercase().contains("encrypt")
tracing::warn!("Critical push error for subscriber {}, removing invalid subscription", subscription.endpoint); || err_debug.to_lowercase().contains("vapid")
|| err_debug.to_lowercase().contains("unauthorized")
|| err_debug.to_lowercase().contains("unknown error");
if is_critical_error {
tracing::warn!("Critical push error detected, removing invalid subscription: {}", subscription.endpoint);
let _ = store.remove_subscription(&subscription.endpoint).await; let _ = store.remove_subscription(&subscription.endpoint).await;
} }
} }