rails for such cases have global exception catcher - http://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html