catch errors thrown by childview mount method on add in ListView

This commit is contained in:
Bruno Windels 2021-06-04 09:37:36 +02:00
parent 05cc1f6757
commit ff370d03db

View file

@ -122,7 +122,13 @@ export class ListView {
this.onBeforeListChanged(); this.onBeforeListChanged();
const child = this._childCreator(value); const child = this._childCreator(value);
this._childInstances.splice(idx, 0, child); this._childInstances.splice(idx, 0, child);
insertAt(this._root, idx, child.mount(this._mountArgs)); let node;
try {
node = child.mount(this._mountArgs);
} catch (err) {
node = errorToDOM(err);
}
insertAt(this._root, idx, node);
this.onListChanged(); this.onListChanged();
} }