Handle UI component errors gracefully
This commit is contained in:
1 parent
79cb0b02d0
commit
ca36bf1b64
1 file changed
+4
@@ -137,9 +137,13 @@ export function contextifyComponent(component: ComponentTypes): ComponentTypes {
|
||||
const view = state.view;
|
||||
state.view = function (vnode) {
|
||||
const context = vnodeContext.get(vnode) || {};
|
||||
try {
|
||||
const res = Reflect.apply(view, this, [vnode]);
|
||||
applyContext(res, context);
|
||||
return res;
|
||||
} catch (err) {
|
||||
return m("p.error", { title: err.message }, "Error!");
|
||||
}
|
||||
};
|
||||
return state;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user