Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.15 KB

File metadata and controls

39 lines (25 loc) · 1.15 KB

80. Global errors and production diagnostics

Learn

  • error
  • unhandledrejection
  • correlation IDs
  • redaction

How it works

Global error events help capture failures that escaped local handling. Report minimal useful context, redact personal data, and avoid swallowing errors that should still reach developer tools. A visible fallback should preserve the user's work and offer a recovery path.

Common mistake

Logging every object or form value can expose sensitive information.

Guided challenge

Install error and unhandled-rejection listeners, trigger a controlled failure, and display a safe recovery message while logging limited details.

Further reading

Run the example

Open example.html, inspect example.js, then edit and refresh. For APIs that need an origin, run a local server from the JavaScripts folder.

Completion check

  • Explain the behavior and its limits in your own words.
  • Test a normal case and a failure or cleanup case.
  • Record when this feature is useful and when a simpler approach is better.