question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature request] Show browser error overlay for runtime errors

See original GitHub issue

I really like the browser error overlay that we get for compile errors (server.hmr.overlay). But runtime errors still appear only in console. It would be nice if runtime errors could also be displayed using the nice browser error overlay.

For example, it would be nice to get the overlay if I forgot to import ref:

<script setup>
    import HelloWorld from './components/HelloWorld.vue'

    const name = ref('Martin')
</script>

I’m talking about this overlay:

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:36
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
janwirthcommented, May 23, 2021

The overlay is an overlay so it’s not replaced, it’s overlaid or am I missing something here?

This does the trick for me:

// REGISTER ERROR OVERLAY
const showErrorOverlay = err => {
    // must be within function call because that's when the element is defined for sure.
    const ErrorOverlay = customElements.get('vite-error-overlay')
    // don't open outside vite environment
    if (!ErrorOverlay) {return}
    console.log(err)
    const overlay = new ErrorOverlay(err)
    document.body.appendChild(overlay)
}

window.addEventListener('error', showErrorOverlay)
window.addEventListener('unhandledrejection', ({reason}) => showErrorOverlay(reason))
5reactions
TechAkayycommented, Dec 16, 2021

Please prioritise this one, we are all spoilt by our previous experiences with webpack and other dev-servers. Really hard to live without the run-time overlay. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

create react app - Disable error overlay in development mode
The error overlay can be disabled by using the stopReportingRuntimeErrors helper utility in the react-error-overlay package.
Read more >
Advanced Features: Error Handling
When there is a runtime error during the development phase of your Next.js application, you will encounter an overlay. It is a modal...
Read more >
Fully Kiosk Browser & App Lockdown Help
Fully Kiosk Browser is a secure and flexible Android Kiosk Browser and App Launcher. Restrict and adjust the functionality of your websites and...
Read more >
How to get an error overlay with React Hot Loader - Jakob Lind
A few days ago, a new version of Create React App was released with many new features. One of the new features released...
Read more >
DevServer
Shows a full-screen overlay in the browser when there are compiler errors or ... Note that some of http-proxy-middleware 's features do not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found