mirror of
https://github.com/esiur/iui.git
synced 2025-06-27 09:23:12 +00:00
Debug
This commit is contained in:
@ -179,6 +179,10 @@ export class Binding {
|
||||
|
||||
if (context.error != undefined)
|
||||
{
|
||||
if (thisArg instanceof IUIElement){
|
||||
thisArg.setError(context.error);
|
||||
}
|
||||
|
||||
console.log("Execution failed", context.error.name + ": " + context.error.message, this.script, this.target);
|
||||
return;
|
||||
}
|
||||
@ -192,6 +196,11 @@ export class Binding {
|
||||
{
|
||||
return await context.value;
|
||||
} catch(ex) {
|
||||
|
||||
if (thisArg instanceof IUIElement){
|
||||
thisArg.setError(ex);
|
||||
}
|
||||
|
||||
console.log("Execution failed", ex.name + ": " + ex.message, this.script, this.target);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import BindingList from "./BindingList.js";
|
||||
|
||||
export class IUI {
|
||||
|
||||
static debugMode = true;
|
||||
|
||||
static _menus = [];
|
||||
static views = [];
|
||||
static modules = {};
|
||||
|
@ -63,6 +63,22 @@ export default class IUIElement extends HTMLElement {
|
||||
await this.updated();
|
||||
}
|
||||
|
||||
|
||||
setError(exception) {
|
||||
if (!IUI.debugMode)
|
||||
return;
|
||||
|
||||
if (this._errorElement == null) {
|
||||
this._errorElement = document.createElement("div");
|
||||
this._errorElement.className = "iui-error";
|
||||
this.append(this._errorElement);
|
||||
}
|
||||
|
||||
var label = document.createElement("span");
|
||||
label.innerHTML = exception;
|
||||
this._errorElement.append(label);
|
||||
}
|
||||
|
||||
|
||||
async updated() {
|
||||
// to be implemented by the user.
|
||||
|
Reference in New Issue
Block a user