A Clojure client for Rollbar
Clojure Shell
Clone or download
conormcd Merge pull request #33 from circleci/safer-json
Try to avoid JSON encoding exceptions
Latest commit f0c3c9f Jun 8, 2018
Permalink
Failed to load latest commit information.
scripts
src/circleci/rollcage Add a backstop encoder Jun 7, 2018
test/circleci/rollcage Add a backstop encoder Jun 7, 2018
.gitignore Release and test instructions Feb 15, 2016
LICENSE Initial commit Apr 22, 2015
README.md Update released version in README Feb 9, 2018
circle.yml Remove upgrade Sep 13, 2017
project.clj Bump clojure.tools.logging to 0.4.0 Dec 15, 2017
requirements.txt

README.md

Rollcage Circle CI codecov.io

A Clojure client for Rollbar

Usage

Rollcage is available on Clojars. Add the following to your project.clj:

[circleci/rollcage "1.0.148"]

You can send exceptions like this:

user=> (require '[circleci.rollcage.core :as rollcage])

user=> (def r (rollcage/client "access-token" {:environment "staging"}))

user=> (try
  #_=>   (/ 0)
  #_=>   (catch Exception e
  #_=>     (rollcage/error r e)))
{:err 0, :result {:id nil, :uuid "1cb0c8bf-3942-4553-a5c4-8adc5d55ed8f"}}

You can also setup handler for all UncaughtExceptions. Call this fn during start-up procedure to ensure all uncaught exceptions will be sent to Rollbar.

user=> (rollcage/setup-uncaught-exception-handler r)

See the full API docs for more information.

Testing

A full CI suite is run on CircleCI. You can run the unit-test suite locally by running lein test. Some tests require access to Rollbar, with a valid access token that has permission to post server items. The token should be specified in the ROLLBAR_ACCESS_TOKEN environment variable.

$ ROLLBAR_ACCESS_TOKEN=<your token> lein test

The tests that require access to Rollbar are annotated with the :integration metadata tag. You can exclude these by using the :unit test selector.

$ lein test :unit

Releasing

Releases are published to Clojars under the CircleCI organisation. You can publish new SNAPSHOT version of Rollcage using leiningen:

$ lein deploy clojars

You can release a new version of Rollcage by editing the version string in project.clj according to semver and removing the -SNAPSHOT qualifier. Then run

$ lein deploy clojars

License

Distributed under the Eclipse Public License.