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