A Rails engine for capturing and notifying when a JavaScript error occurs in the browser
Ruby HTML CSS JavaScript CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
config
lib
test
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
tastes_bitter.gemspec

README.md

Tastes Bitter

Get an email notification when a JavaScript error occurs in your Rails application.

How it works

The JavaScript hooks into the window.onerror event by sending an XHR with the error data which is then emailed.

Install

Add the gem to your Gemfile.

gem 'tastes_bitter'

Use Bundler to install it.

$ bundle install

Run the install generator.

$ bundle exec rails generate tastes_bitter:install

Configure

Open config/initializers/tastes_bitter.rb and update the configuration.

TastesBitter.configure do |config|

  config.mailer_receiver = "notifications@example.com"
  config.mailer_sender = "notifications@example.com"
  config.mailer_subject_prefix = "[JavaScript Error] "

end

Make sure you have ActionMailer configured in order for emails to be sent.

Add the JavaScript file to application.js.

//= require tastes_bitter/javascript_errors

It does matter where you include the JavaScript. It will only catch errors that occur after it has been loaded into the page. In general, you'll want to include it around the top of application.js. This will ensure it catches all errors from any other JavaScript code in your application.