diff options
| author | Craig Jennings <c@cjennings.net> | 2026-03-14 12:55:48 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-03-14 12:55:48 -0500 |
| commit | 5ca91aec8117a26d9ec9e65bace21764996a2136 (patch) | |
| tree | 317f55ea30d4fe98e3f7e6695d50bee1a048b4ca /modules | |
| parent | 666bf2a07290d7428423d36f8c55317b140e4e09 (diff) | |
| download | dotemacs-5ca91aec8117a26d9ec9e65bace21764996a2136.tar.gz dotemacs-5ca91aec8117a26d9ec9e65bace21764996a2136.zip | |
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.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/slack-config.el | 28 |
1 files changed, 20 insertions, 8 deletions
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." |
