Skipping rescue handlers in dev mode

Hi all

To make my error pages more user-friendly I'm rendering my error messages (404, 500 etc) using the site's layout. To do this I'm using rescue_from as below:

rescue_from Exception, :with => :server_error rescue_from ActionController::RoutingError, ActiveRecord::RecordNotFound, :with => :not_found_error

private

def server_error(exception)   activate_authlogic   render :template => 'common/500', :status => 500 end

def not_found_error(exception)   activate_authlogic   render :template => 'common/404', :status => 404 end

Obviously not as DRY as it could be but I'm really just experimenting right now. Also, not completely happy with having to call activate_authlogic but it's a necessary evil.

I'd like to be able to totally bypass these handlers when I'm in dev mode and have the regular stack trace appear. Anyone have ideas about how I could do this cleanly without having to resort to checking consider_all_requests_local and local_request??

Also, I realise that some exceptions might occur before this code can be run. Any ideas on how this code might behave in that situation?

Thanks Tristan

try this unless ActionController::Base.consider_all_requests_local   rescue_from Exception, :with => :server_error   rescue_from ActionController::RoutingError, ActiveRecord::RecordNotFound, :with => :not_found_error end

You'll notice in config/development.rb you set consider_all_requests_local to true