From 099d47e7e846bc58fc67a84c03893907eed72871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Birkir=20Rafn=20Gu=C3=B0j=C3=B3nsson?= Date: Sun, 4 Nov 2018 11:55:20 -0500 Subject: [PATCH] fix(gatsby-plugin-layout): log uncaught errors in old browsers (#9635) IE11 doesn't show the actual error, just `Error: Uncaugt error thrown` without any stack traces. There is no way to implement try/catch around this as this module is the first entry point. Adding an Error Boundary on the Layout component does not work. --- packages/gatsby-plugin-layout/src/wrap-page.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/gatsby-plugin-layout/src/wrap-page.js b/packages/gatsby-plugin-layout/src/wrap-page.js index 3c18bbecd8bcc..1af3ddde420fc 100644 --- a/packages/gatsby-plugin-layout/src/wrap-page.js +++ b/packages/gatsby-plugin-layout/src/wrap-page.js @@ -11,6 +11,9 @@ try { `Please create layout component in that location or specify path to layout component in gatsby-config.js` ) } else { + // Logging the error for debugging older browsers as there is no way + // to wrap the thrown error in a try/catch. + console.error(e) throw e } }