Log errors when mounting views to the console for easier reference

From the console, I can click the source references in the stack trace
to jump to the spot in the code where things are going wrong.

It also helps with the problem of the error not having enough
space to be read in some components.

Split off from https://github.com/vector-im/hydrogen-web/pull/653
This commit is contained in:
Eric Eastwood 2022-09-16 13:50:29 -05:00
parent 5f9cfffa3b
commit 8f414f4cf4

View File

@ -22,6 +22,9 @@ export function mountView(view: IView, mountArgs?: IMountArgs): ViewNode {
try {
node = view.mount(mountArgs);
} catch (err) {
// Log it to the console so it's easy to reference
console.error(err);
// Then render our error boundary to the DOM
node = errorToDOM(err);
}
return node;