interface.js: add InterfaceElement.handleError()

this allows elements to handle errors directly after catching them
rather than having a generic error
This commit is contained in:
dogeystamp 2023-01-26 19:11:31 -05:00
parent 3caf1b72ba
commit 6972790053
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -413,6 +413,13 @@ class FormElement extends InterfaceElement {
this.handle.after(box);
this.alerts.push(box);
}
handleError(e, extraInfo="") {
if (extraInfo !== "") {
extraInfo = ` (${extraInfo})`;
}
this.alertBox("alert-error", e.message + extraInfo);
console.error(e);
}
clearAlerts() {
for (const box of this.alerts) {
box.remove();