From 8f414f4cf45cf432a59783aa6e5e4032db50dc2f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 16 Sep 2022 13:50:29 -0500 Subject: [PATCH] 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 --- src/platform/web/ui/general/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/web/ui/general/utils.ts b/src/platform/web/ui/general/utils.ts index b310571f..3f470048 100644 --- a/src/platform/web/ui/general/utils.ts +++ b/src/platform/web/ui/general/utils.ts @@ -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;