Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time


Gem Version Build Status Coverage Status Code Climate Dependency Status

Temescal is Rack middleware that will automatically rescue exceptions for JSON APIs and render a nice, clean JSON response with the error information. No need to write custom error handling logic for your apps - Temescal will take care of it for you!

Getting Started

Add the gem to your Gemfile and run bundle install:

gem 'temescal'

Since Temescal is just Rack middleware, adding it to your application is super easy. For Rails, add an initializer:

Rails.application.config.middleware.use Temescal::Middleware do |config|
  config.monitors = :airbrake, :new_relic
  config.default_message = "Oops! Something went kablooey!"

For Sinatra:

use Temescal::Middleware do |config|
  config.monitors = :airbrake, :new_relic
  config.default_message = "Oops! Something went kablooey!"

Default Behavior

By default, Temescal will render a JSON response formatted as such (using StandardError with a message of "Foobar" as an example):

  "meta": {
    "status": 500,
    "error": "StandardError",
    "message": "Foobar"

Temescal will also log the error for you through STDERR.


Though Temescal will log an error for you, it won't necessarily be picked up by your monitoring solution of choice in a production environment. Luckily, Temescal provides integration with popular monitoring services.

The services currently supported are:

If you use a different monitoring service that you'd like to see supported, feel free to submit an issue. Better yet, pull requests are more than welcome!

Note that you'll need the gem for your monitor installed and configured for your application in order for Temescal to properly work with it.


Temescal provides several configuration options for you. You can set these options when configuring the middleware for your application.

monitors to set the monitors you'd like to use with Temescal. It takes symbols of monitor names (currently :airbrake, :bugsnag, :new_relic, and :honeybadger).

raise_errors to set whether you'd like to override Temescal and raise all errors without rendering a Temescal response. Set to true to enable.

default_message to set an all-encompasing message to use in responses instead of the exception's message. Takes a string.

ignored_errors to set which exception types you'd like to not be reported to a monitor or logged. Specified errors will still have error responses built, but they won't trigger any sort of logging. It takes the class names of the exceptions you'd like ignored.


Copyright 2013-2014 Todd Bealmear. See LICENSE for details.


Rack Middleware for gracefully handling exceptions in JSON APIs.




You can’t perform that action at this time.