Commit 2bcac136 authored by JC Brand's avatar JC Brand

Catch, log and report errors related to vcard update

parent e3bce029
......@@ -10,6 +10,7 @@ import "converse-modal";
import * as twemoji from "twemoji";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import tpl_alert from "templates/alert.html";
import tpl_chatbox from "templates/chatbox.html";
import tpl_chatbox_head from "templates/chatbox_head.html";
import tpl_chatbox_message_form from "templates/chatbox_message_form.html";
......@@ -233,7 +234,18 @@ converse.plugins.add('converse-chatview', {
if (ev && ev.preventDefault) { ev.preventDefault(); }
const refresh_icon = this.el.querySelector('.fa-refresh');
u.addClass('fa-spin', refresh_icon);
await _converse.api.vcard.update(this.model.contact.vcard, true);
try {
await _converse.api.vcard.update(this.model.contact.vcard, true);
} catch (e) {
_converse.log(e, Strophe.LogLevel.FATAL);
this.el.querySelector('.modal-body').insertAdjacentHTML(
'afterBegin',
tpl_alert({
'type': 'alert-danger',
'message': __('Sorry, something went wrong while trying to refresh')
})
);
}
u.removeClass('fa-spin', refresh_icon);
},
......
......@@ -11,7 +11,6 @@ import "converse-modal";
import _FormData from "formdata-polyfill";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import tpl_alert from "templates/alert.html";
import tpl_chat_status_modal from "templates/chat_status_modal.html";
import tpl_profile_modal from "templates/profile_modal.html";
import tpl_profile_view from "templates/profile_view.html";
......
<div class="alert {{{o.type}}}" role="alert">{{{o.message}}}</div>
<div class="alert {{{o.type}}}" role="alert"><p>{{{o.message}}}</p></div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment