From 7941618b74a14df29c48304a4162fce59d4499ec Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 14 Mar 2026 12:55:48 -0500 Subject: fix(slack): add error visibility to notification handler Websocket library silently swallows callback errors via condition-case. Wrap cj/slack-notify in condition-case to surface errors in *Messages*. Add cj/slack-test-notify command for pipeline verification. --- assets/abbrev_defs | 5 +++-- modules/slack-config.el | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/assets/abbrev_defs b/assets/abbrev_defs index 58168472..47a2685b 100644 --- a/assets/abbrev_defs +++ b/assets/abbrev_defs @@ -15,6 +15,7 @@ ("accomoplished" "accomplished" nil :count 0) ("acerage" "acreage" nil :count 0) ("acheive" "achieve" nil :count 0) + ("acknowledgement" "an" nil :count 0) ("acknowledment" "acknowledgment" nil :count 0) ("acknowlege" "acknowledge" nil :count 0) ("acommodate" "accommodate" nil :count 0) @@ -214,7 +215,7 @@ ("higeine" "hygiene" nil :count 0) ("hipocrit" "hypocrite" nil :count 0) ("horozontal" "horizontal" nil :count 0) - ("horus" "hours" nil :count 0) + ("horus" "hours" nil :count 1) ("hospiralization" "hospitalization" nil :count 0) ("hrie" "hire" nil :count 0) ("htey" "they" nil :count 3) @@ -446,7 +447,7 @@ ("withdrawls" "withdrawals" nil :count 0) ("withold" "withhold" nil :count 0) ("workign" "working" nil :count 3) - ("woudl" "would" nil :count 1) + ("woudl" "would" nil :count 2) ("wouldln't" "wouldn't" nil :count 0) )) diff --git a/modules/slack-config.el b/modules/slack-config.el index 2b97a07c..6260583f 100644 --- a/modules/slack-config.el +++ b/modules/slack-config.el @@ -92,14 +92,26 @@ (defun cj/slack-notify (message room team) "Send desktop notification for DMs and @mentions only. MESSAGE is the incoming slack message, ROOM is the channel/DM, -TEAM is the slack team object." - (when (and (not (slack-message-minep message team)) - (or (slack-im-p room) - (slack-message-mentioned-p message team))) - (let ((title (format "Slack: %s" (slack-room-display-name room team))) - (body (slack-message-body message team))) - (start-process "slack-notify" nil - "notify" "info" title body)))) +TEAM is the slack team object. +Errors are logged to *Messages* since the websocket library silently +swallows exceptions via `websocket-try-callback'." + (condition-case err + (when (and (not (slack-message-minep message team)) + (or (slack-im-p room) + (slack-message-mentioned-p message team))) + (let ((title (format "Slack: %s" (slack-room-display-name room team))) + (body (or (slack-message-body message team) ""))) + (start-process "slack-notify" nil + "notify" "info" title body))) + (error (message "cj/slack-notify error: %S" err)))) + +(defun cj/slack-test-notify () + "Send a test desktop notification to verify the notify pipeline works." + (interactive) + (condition-case err + (start-process "slack-notify-test" nil + "notify" "info" "Slack: Test" "Notification pipeline works") + (error (message "cj/slack-test-notify error: %S" err)))) (defun cj/slack-mark-read-and-bury () "Mark the current Slack channel as read and bury the buffer." -- cgit v1.2.3