Skip to content

Commit

Permalink
fix error handling for web-push
Browse files Browse the repository at this point in the history
  • Loading branch information
ginesdt committed Sep 29, 2023
1 parent 9642873 commit c690bc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/streamtide/ui/components/error_notification.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

(defn- parse-error [js-error]
(let [js-error (if (and (coll? js-error) (not (map? js-error))) (first js-error) js-error)]
(-> (js->clj js-error :keywordize-keys true)
:message)))
(let [{:keys [:message :error]} (js->clj js-error :keywordize-keys true)]
(or message error))))

(re-frame/reg-event-fx
::show-error
Expand Down
5 changes: 2 additions & 3 deletions src/streamtide/ui/components/web_push.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,5 @@
(re-frame/reg-event-fx
::log-and-show
(fn [{:keys [db]} [_ message details]]
(merge
{:dispatch-n [[::logging/error message details]
[::error-notification/show-error "Cannot subscribe to push notifications" details]]})))
{:dispatch-n [[::logging/error message details]
[::error-notification/show-error "Cannot subscribe to push notifications" [details]]]}))

0 comments on commit c690bc2

Please sign in to comment.