Handle request error

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2019-02-19 09:24:53 +01:00
parent 448581058c
commit bcbaeb2cd9
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
2 changed files with 9 additions and 2 deletions

View File

@ -424,6 +424,11 @@
(log/error "Error on mark-trusted-peer: " error) (log/error "Error on mark-trusted-peer: " error)
(mailserver/check-connection cofx))) (mailserver/check-connection cofx)))
(handlers/register-handler-fx
:mailserver.callback/request-error
(fn [cofx [_ error]]
(mailserver/handle-request-error cofx error)))
;; network module ;; network module
(handlers/register-handler-fx (handlers/register-handler-fx

View File

@ -288,7 +288,9 @@
(fn [error request-id] (fn [error request-id]
(if-not error (if-not error
(log/info "mailserver: messages request success for topic " topics "from" from "to" to) (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 (re-frame/reg-fx
:mailserver/request-messages :mailserver/request-messages