From bcbaeb2cd9e90170b5664f67d86624e925e209a3 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Tue, 19 Feb 2019 09:24:53 +0100 Subject: [PATCH] Handle request error Signed-off-by: Andrea Maria Piana --- src/status_im/events.cljs | 7 ++++++- src/status_im/mailserver/core.cljs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index dc4b8c8c06..212f1a8a8e 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -424,6 +424,11 @@ (log/error "Error on mark-trusted-peer: " error) (mailserver/check-connection cofx))) +(handlers/register-handler-fx + :mailserver.callback/request-error + (fn [cofx [_ error]] + (mailserver/handle-request-error cofx error))) + ;; network module (handlers/register-handler-fx @@ -1692,4 +1697,4 @@ (handlers/register-handler-fx :stickers/open-sticker-pack (fn [cofx [_ uri]] - (stickers/open-sticker-pack cofx uri))) \ No newline at end of file + (stickers/open-sticker-pack cofx uri))) diff --git a/src/status_im/mailserver/core.cljs b/src/status_im/mailserver/core.cljs index 90a9fffb86..6d4dd47c98 100644 --- a/src/status_im/mailserver/core.cljs +++ b/src/status_im/mailserver/core.cljs @@ -288,7 +288,9 @@ (fn [error request-id] (if-not error (log/info "mailserver: messages request success for topic " topics "from" from "to" to) - (log/error "mailserver: messages request error for topic " topics ": " error)))))) + (do + (log/error "mailserver: messages request error for topic " topics ": " error) + (re-frame/dispatch [:mailserver.callback/request-error (i18n/label :t/mailserver-request-error-title)]))))))) (re-frame/reg-fx :mailserver/request-messages