Site icon Leonid Mamchenkov

Capture and Report JavaScript Errors with window.onerror

Capture and Report JavaScript Errors with window.onerror” tutorial shows an easy way to capture, log and troubleshoot client-side errors:

onerror is a special browser event that fires whenever an uncaught JavaScript errorhas been thrown. It’s one of the easiest ways to log client-side errors and report them to your servers. It’s also one of the major mechanisms by which Sentry’s client JavaScript integration (raven-js) works.

window.onerror = function(msg, url, lineNo, columnNo, error) {
  // ... handle error ...
  return false;
}
Exit mobile version