Wrap buildCurrent in try in case of unknown errors + verify no need to be async.

This commit is contained in:
NI
2019-08-27 21:10:21 +08:00
parent 134f0f07d3
commit 9257bd40c3

View File

@@ -257,19 +257,20 @@ export default {
this.$emit("cancel", true); this.$emit("cancel", true);
}, },
cancel() { cancel() {
if (this.working) {
return;
}
if (this.cancelled) { if (this.cancelled) {
return; return;
} }
this.cancelled = true; this.cancelled = true;
if (this.working) {
return;
}
this.sendCancel(); this.sendCancel();
}, },
buildCurrent(next) { buildCurrent(next) {
try {
this.current = buildEmptyCurrent(); this.current = buildEmptyCurrent();
this.working = this.getConnector().wizard.started(); this.working = this.getConnector().wizard.started();
@@ -318,6 +319,15 @@ export default {
} }
return next; return next;
} catch (e) {
this.current.title = "Encountered an error";
this.current.message = e;
this.working = false;
this.disabled = true;
throw e;
}
}, },
getConnector() { getConnector() {
if (this.currentConnector === null) { if (this.currentConnector === null) {
@@ -377,9 +387,9 @@ export default {
event.target.style.height = ""; event.target.style.height = "";
event.target.style.height = event.target.scrollHeight + "px"; event.target.style.height = event.target.scrollHeight + "px";
}, },
async verify(key, field, force) { verify(key, field, force) {
try { try {
field.message = "" + (await field.field.verify(field.field.value)); field.message = "" + field.field.verify(field.field.value);
field.inputted = true; field.inputted = true;
field.verified = true; field.verified = true;
field.error = ""; field.error = "";