0.1.0 • Published 7 years ago

safely.js v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Safely.js

safely(keepGoingIfThisFunctionFails)

Exceptions are rescued 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 aliases 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 rescued exceptions. Turn this off with:

Safely.tag = false

To report exceptions manually:

Safely.reportException(e)

Contributing

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