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 | 7941618b74a14df29c48304a4162fce59d4499ec (patch) | |
| tree | 1c8e4f91f0f6cc7a1a28aabfc975dd821d28517b /modules | |
| parent | d35e1aaf4eb2bcb276e59565d0ba612444822a69 (diff) | |
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." |
