Sha256: e7955f200390c223c19cedee0f3fab1c05e09bf54d1c8983dfb8888f968d4f00
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
module PublishMyData class ApplicationController < ActionController::Base # Note: this order matters. Perversely, need to put more general errors first. rescue_from Exception, :with => :handle_uncaught_error rescue_from Tripod::Errors::ResourceNotFound, :with => :handle_resource_not_found rescue_from RestClient::RequestTimeout, :with => :handle_timeout private # TODO: deal with javaascript errors - respond with 200 def handle_uncaught_error(e) @e = e # TODO: notify error handling service. respond_to do |format| format.html { render(:template => "publish_my_data/errors/uncaught", :layout => 'publish_my_data/error', :status => 500) and return false } format.any{ head(:status => 500, :content_type => 'text/plain') and return false } end end def handle_timeout(e) respond_to do |format| format.html { render(:template => "publish_my_data/errors/timeout", :layout => 'publish_my_data/error', :status => 503) and return false } format.any { head(:status => 503, :content_type => 'text/plain') and return false } end end def handle_resource_not_found(e) respond_to do |format| format.html { render(:template => "publish_my_data/errors/not_found", :layout => 'publish_my_data/error', :status => 404) and return false } format.any { head(:status => 404, :content_type => 'text/plain') and return false } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems