Skip to content

Commit

Permalink
revert abort error filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc committed Nov 10, 2024
1 parent 71de461 commit 17f153e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
17 changes: 5 additions & 12 deletions src/renderer/document/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[renderer.document.handlers :as h]
[renderer.element.handlers :as element.h]
[renderer.history.handlers :as history.h]
[renderer.notification.events :as notification.e]
[renderer.notification.events :as-alias notification.e]
[renderer.notification.handlers :as notification.h]
[renderer.notification.views :as notification.v]
[renderer.snap.handlers :as snap.h]
Expand Down Expand Up @@ -182,20 +182,13 @@
:formatter #(mapv edn/read-string %)}}
{::app.fx/file-open {:options file-picker-options
:on-success [::file-read]
:on-error [::file-error]}})))
:on-error [::notification.e/exception]}})))

(rf/reg-event-fx
::file-read
(fn [_ [_ file]]
{::fx/read file}))

(rf/reg-event-fx
::file-error
(fn [{:keys [db]} [_ ^js/Error error]]
(cond-> db
(not= (.-name error) "AbortError")
(notification.h/add (notification.v/exception error)))))

(rf/reg-event-fx
::open-directory
(fn [_ [_ path]]
Expand Down Expand Up @@ -239,7 +232,7 @@
:formatter (fn [file] {:id (:id document)
:title (.-name file)})
:on-success [::saved]
:on-error [::file-error]}}))))
:on-error [::notification.e/exception]}}))))

(rf/reg-event-fx
::download
Expand All @@ -263,7 +256,7 @@
:formatter (fn [file] {:id id
:title (.-name file)})
:on-success [::close-saved]
:on-error [::file-error]}}))))
:on-error [::notification.e/exception]}}))))

(rf/reg-event-fx
::save-as
Expand All @@ -280,7 +273,7 @@
:formatter (fn [file] {:id (:id document)
:title (.-name file)})
:on-success [::saved]
:on-error [::file-error]}}))))
:on-error [::notification.e/exception]}}))))

(rf/reg-event-db
::saved
Expand Down
12 changes: 2 additions & 10 deletions src/renderer/tool/impl/element/image.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
(:require
[re-frame.core :as rf]
[renderer.app.effects :as-alias app.fx]
[renderer.notification.handlers :as notification.h]
[renderer.notification.views :as notification.v]
[renderer.notification.events :as-alias notification.e]
[renderer.tool.handlers :as tool.h]
[renderer.tool.hierarchy :as hierarchy]
[renderer.utils.drop :as drop]))
Expand All @@ -23,7 +22,7 @@
"image/jpeg" [".jpeg" ".jpg"]
"image/bmp" [".fmp"]}}]}
:on-success [::success]
:on-error [::error]}]))
:on-error [::notification.e/exception]}]))

(rf/reg-event-fx
::success
Expand All @@ -32,13 +31,6 @@
::add-image [file (or (:point (:nearest-neighbor db))
(:adjusted-pointer-pos db))]}))

(rf/reg-event-db
::error
(fn [db [_ error]]
(cond-> db
(not= (.-name error) "AbortError")
(notification.h/add (notification.v/exception error)))))

(rf/reg-fx
::add-image
(fn [[file position]]
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/tool/impl/misc/dropper.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@
(rf/reg-event-db
::error
(fn [db [_ error]]
(cond-> (h/activate db :transform)
(not= (.-name error) "AbortError")
(notification.h/add (notification.v/exception error)))))
(-> (h/activate db :transform)
(notification.h/add (notification.v/exception error)))))

0 comments on commit 17f153e

Please sign in to comment.