solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Stack traces in default client-side error behaviour

Open mattosborn opened this issue 2 years ago • 0 comments

The default unhandled client-side error behaviour is to render the error as HTML and log it to console.

The rendered error shows the original stack trace, whereas the logged error shows the source-mapped stack trace (console.error handles the mapping).

Is this the intended behaviour at present?

Simplest workaround I've found is to drop source-map-support into your project to handle this mapping implicitly. Adding this to <Head> works, and should map traces before they are rendered to HTML:

<script src="/node_modules/source-map-support/browser-source-map-support.js" />
<script>sourceMapSupport.install()</script>

It would be great if solid-start could handle this mapping by default in dev mode. I'm not sure of the best cross-engine approach to making this happen. It doesn't look like V8 makes this easy, and I don't know about other engines, which I guess is why libs exist for this. Loading a lib like source-map-support would be a simple solution but I'm not sure what the trade-offs are here.

mattosborn avatar Jan 27 '23 16:01 mattosborn