Skip to content

Sends window.onerror() errors to `/log` via XHR

License

Notifications You must be signed in to change notification settings

i6systems/window-onerror-logger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Window OnError Logger

This is a tiny (< 1K ungzipped) window.onerror logger which sends the errors to a /log endpoint.

Features

  • errors which occur in a single tick are batched and sent in a single XHR
  • identical errors are suppressed
  • legacy browsers which don't support XMLHttpRequest are not supported by this logger
  • only the absolutely necessary features are implemented in order to minimize the surface area for bugs

Usage

Your application should fetch the node_modules/window-onerror-logger/logger.min.js from disk (after npm install window-onerror-logger, of course) and add it as the first element in the <head>.

<html>
  <head>
    <script type="javascript">
      ${getFileFromDisk('node_modules/window-onerror-logger/dist/logger.min.js')}
    </script>
  </head>
  <body>
    <!-- ... -->
  </body>
</html>

License

Apache-2.0

About

Sends window.onerror() errors to `/log` via XHR

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%