mirror of
https://github.com/esiur/iui.git
synced 2025-05-06 06:42:58 +00:00
Debug
This commit is contained in:
parent
1294b0f413
commit
12627b1896
16
css/iui.css
16
css/iui.css
@ -3098,4 +3098,20 @@ html[dir='rtl'] .navbar-item[level='1'] {
|
|||||||
.codepreview-bar
|
.codepreview-bar
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.iui-error {
|
||||||
|
background: #7171714d;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iui-error > span {
|
||||||
|
background: red;
|
||||||
|
color: white;
|
||||||
|
padding: 4px;
|
||||||
}
|
}
|
@ -179,6 +179,10 @@ export class Binding {
|
|||||||
|
|
||||||
if (context.error != undefined)
|
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);
|
console.log("Execution failed", context.error.name + ": " + context.error.message, this.script, this.target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -192,6 +196,11 @@ export class Binding {
|
|||||||
{
|
{
|
||||||
return await context.value;
|
return await context.value;
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
|
|
||||||
|
if (thisArg instanceof IUIElement){
|
||||||
|
thisArg.setError(ex);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("Execution failed", ex.name + ": " + ex.message, this.script, this.target);
|
console.log("Execution failed", ex.name + ": " + ex.message, this.script, this.target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import BindingList from "./BindingList.js";
|
|||||||
|
|
||||||
export class IUI {
|
export class IUI {
|
||||||
|
|
||||||
|
static debugMode = true;
|
||||||
|
|
||||||
static _menus = [];
|
static _menus = [];
|
||||||
static views = [];
|
static views = [];
|
||||||
static modules = {};
|
static modules = {};
|
||||||
|
@ -63,6 +63,22 @@ export default class IUIElement extends HTMLElement {
|
|||||||
await this.updated();
|
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() {
|
async updated() {
|
||||||
// to be implemented by the user.
|
// to be implemented by the user.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user