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:
parent
3caf1b72ba
commit
6972790053
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user