Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 538197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:00:22+00:00 2026-05-13T10:00:22+00:00

I have a number of controllers in my Ruby on Rails apps with a

  • 0

I have a number of controllers in my Ruby on Rails apps with a rescue handler at the end of the action that basically catches any unhandled errors and returns some kind of “user friendly” error. However, when I’m doing rake test I’d like to have those default rescue handlers disabled so I can see the full error & stack trace. Is there any automated way to do this?

Update to clarify: I have an action like this:

def foo
  # do some stuff...
rescue
  render :text => "Exception: #{$!}" # this could be any kind of custom render
end

Now when I functional test this, if the exception is raised then I’m going to get just a little bit of info about the exception, but what I’d like is for it to act as though there’s no rescue handler there, so I get the full debug information.

Update: SOLUTION

I did this:

  rescue:
    raise unless Rails.env.production?
    render :text => "Exception: #{$!}" # this could be any kind of custom render
  end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:00:23+00:00Added an answer on May 13, 2026 at 10:00 am

    Not quite automated, but how modifying your code to re-throw exceptions whenever called within a test?

    Perhaps something like this:

    def foo
      # do some stuff...
    rescue
      raise if ENV["RAILS_ENV"] == "test"
      render :text => "Exception: #{$!}" # this could be any kind of custom render
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app that processes a large (millions) number of records in
I have built a Ruby on Rails (2.3.8) application that allows users to track
I have a number of Controllers in my project that all inherit from a
I have a simple ruby on rails project that I'm trying to use a
I have two rails apps that I am thinking about merging into one because
I have a number of simple controller classes that use Doctrine's entity manager to
I have a C++ application that includes a number of structures with manually controlled
I'm stuck with the following scenario and appreciate any help/advice.. Requirement I have number
I have a number of Controllers, and I want them all to have an
I'm using Rails 2.3.4/Ruby 1.9.1 for my application. In the view I have this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.