RaiseJs
Raise JavaScript errors as Ruby exceptions in your Rails app.
Install
Add these lines to your Gemfile:
# Raise JavaScript errors as Ruby exceptions
gem "raise_js"And add raise_js to your Gemfile along with jquery and jquery_ujs:
//= require raise_js
//= require jquery
//= require jquery_ujsCatching
Use a gem like exception_notification to send you an email whenever Rails raises exceptions.
If you want to catch it manually, you can catch RaiseJs::JavaScriptError.