<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s" -->

---
title: Catch JavaScript errors with user-friendly error feedback
description: A practical guide to building an ErrorFeedback JavaScript class that catches unhandled errors and promise rejections, then displays them in a dismissible...
canonical: https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Catch JavaScript errors with user-friendly error feedback | daily.dev
og:description: A practical guide to building an ErrorFeedback JavaScript class that catches unhandled errors and promise rejections, then displays them in a dismissible...
og:url: https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s
og:image: https://api.daily.dev/og/posts/Ecje7Ol0s.png
og:image:alt: Catch JavaScript errors with user-friendly error feedback
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Catch JavaScript errors with user-friendly error feedback

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 4 min read · 0 upvotes · 0 comments

## Summary

A practical guide to building an ErrorFeedback JavaScript class that catches unhandled errors and promise rejections, then displays them in a dismissible banner. The class uses window.onerror and window.onunhandledrejection to intercept errors, shows a configurable message banner that auto-dismisses after 5 seconds, and can be extended to integrate with error monitoring services like Appsignal or Honeybadger. Aimed at Rails developers using Hotwire/Stimulus who want to improve UX when JavaScript fails silently.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://railsdesigner.com/js-errors-feedback/>

## Similar posts on daily.dev

- [A practical guide to React error monitoring](https://daily.dev/posts/a-practical-guide-to-react-error-monitoring-qmxiyodzb) · Datadog · 4 upvotes · 0 comments
- [Stop Memorizing JavaScript APIs: Learn Them with Tiny Experiments Instead](https://daily.dev/posts/stop-memorizing-javascript-apis-learn-them-with-tiny-experiments-instead-xlqsajk7h) · SitePoint · 0 upvotes · 0 comments
- [Making the Browser Agent Resilient: Implementing Autonomous Error Handling and Retries](https://daily.dev/posts/making-the-browser-agent-resilient-implementing-autonomous-error-handling-and-retries-jyyalsbdl) · ITNEXT · 1 upvotes · 1 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#ux](https://daily.dev/tags/ux), [#rails](https://daily.dev/tags/rails)

[View this post on daily.dev](https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Catch JavaScript errors with user-friendly error feedback","url":"https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s"},"datePublished":"2026-04-23T08:32:27.155Z","dateModified":"2026-04-23T08:33:01.767Z","description":"A practical guide to building an ErrorFeedback JavaScript class that catches unhandled errors and promise rejections, then displays them in a dismissible...","image":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","thumbnailUrl":"https://media.daily.dev/image/upload/s--foaA6JGU--/f_auto/v1722860399/public/Placeholder%2004","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/catch-javascript-errors-with-user-friendly-error-feedback-ecje7ol0s","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,ux,rails","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"Catch JavaScript errors with user-friendly error feedback"}]}
```

