Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

ankane/safely.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safely.js

safely(keepGoingIfThisFunctionFails)

Exceptions are caught and automatically reported to your favorite reporting service.

In development and test environments, exceptions are raised so you can fix them.

Use It Everywhere

“Oh no, analytics brought down search”

safely(trackSearch)

Also aliased as yolo.

Installation

Download safely.js, include it, and set the environment

<script src="path/to/safely.js"></script>
<script>
  Safely.env = "production"
</script>

Reporting

Reports exceptions to Rollbar out of the box.

Customize reporting with:

Safely.reportExceptionMethod = function (e) {
  // report to your favorite service
}

By default, exception messages are prefixed with [safely]. This makes it easier to spot caught exceptions. Turn this off with:

Safely.tag = false

To report exceptions manually:

Safely.reportException(e)

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

About

Catch and report exceptions in non-critical code

Resources

License

Stars

Watchers

Forks

Packages

No packages published