Uncaught errors and promise rejections
No code needed. The agent listens for anything your app fails to catch. Each button causes a genuine error of that type, so the error class and stack trace are real.
Throw real JavaScript errors, report the ones you catch, decide which ones matter, then find every one of yours in a shared New Relic account.
noticeError() create JavaScriptError events. console.error creates an ERROR Log. This page shows both.
// 1. Uncaught errors are captured automatically cart.total.toFixed(2) // TypeError // 2. Report errors you catch and handle try { applyCoupon(code) } catch (err) { newrelic.noticeError(err, { coupon: code }) } // 3. Drop the noise, group what matters newrelic.setErrorHandler(err => /ResizeObserver/.test(err.message) ? true : { group: 'Checkout' })
These are real errors. Your browser console will show red text, and that is the point. The page keeps working, and the feed on the right shows what New Relic receives.
addRelease() stamps this version on every error you send, so you can compare releases in Errors Inbox.
No code needed. The agent listens for anything your app fails to catch. Each button causes a genuine error of that type, so the error class and stack trace are real.
newrelic.noticeError()Your code caught the error and recovered, but you still want to know. The user sees nothing.
newrelic.setErrorHandler()One handler sees every error before it is sent. Return true to drop it, or { group } to label it in Errors Inbox. Edit the rules, then throw an error that matches.
An error tells you what broke with a stack trace, grouped in Errors Inbox. An ERROR log tells you what was happening in your own words. Send both, linked by a shared errorId, and you can jump from one to the other. Compare it with the Logs demo.
Each scenario plays out a short story using a mix of the methods above. Watch how the error handler rules change the outcome.
Errors are sent in batches, so allow up to a minute. Everything below is already filled in with your code, NR-XXXX.
errorId values to errors from the "Both" button.demoCode = NR-XXXX to find your own occurrences.setErrorHandler() is for.