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.handle.after(box);
|
||||||
this.alerts.push(box);
|
this.alerts.push(box);
|
||||||
}
|
}
|
||||||
|
handleError(e, extraInfo="") {
|
||||||
|
if (extraInfo !== "") {
|
||||||
|
extraInfo = ` (${extraInfo})`;
|
||||||
|
}
|
||||||
|
this.alertBox("alert-error", e.message + extraInfo);
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
clearAlerts() {
|
clearAlerts() {
|
||||||
for (const box of this.alerts) {
|
for (const box of this.alerts) {
|
||||||
box.remove();
|
box.remove();
|
||||||
|
Loading…
Reference in New Issue
Block a user