Skip to content

Commit

Permalink
handle error message for generic errors
Browse files Browse the repository at this point in the history
  • Loading branch information
BalogunofAfrica committed Jul 25, 2024
1 parent 0a16aa1 commit 3918143
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/status_im/contexts/wallet/send/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,22 @@

(rf/reg-event-fx :wallet/handle-suggested-routes
(fn [_ data]
(let [error (-> data first :ErrorResponse)
suggested-routes-new-data (data-store/rpc->suggested-routes data)
suggested-routes (-> (first suggested-routes-new-data)
(update :best #(map data-store/new->old-route-path %))
(update :candidates #(map data-store/new->old-route-path %)))]
(when error
(if-let [error (some-> data
first
:ErrorResponse
(#(if (= (:code %) "0") "An error occurred" (:details %))))]
(do
(log/error "failed to get suggested routes (async)"
{:event :wallet/handle-suggested-routes
:error error}))
{:fx [(if error
[:dispatch [:wallet/suggested-routes-error (:details error)]]
[:dispatch
[:wallet/suggested-routes-success suggested-routes]])]})))
:error error})
{:fx [[:dispatch [:wallet/suggested-routes-error error]]]})
(let [suggested-routes-new-data (data-store/rpc->suggested-routes data)
suggested-routes (-> suggested-routes-new-data
first
(update :best #(map data-store/new->old-route-path %))
(update :candidates #(map data-store/new->old-route-path %)))]
{:fx [[:dispatch
[:wallet/suggested-routes-success suggested-routes]]]}))))

(rf/reg-event-fx :wallet/add-authorized-transaction
(fn [{:keys [db]} [transaction]]
Expand Down

0 comments on commit 3918143

Please sign in to comment.