Error During Fail Safe Response Rails
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss exceptions_app the workings and policies of this site About Us Learn more rails exceptions about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow
Rails Rescue_from
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping
Rails Middleware
each other. Join them; it only takes a minute: Sign up Error during failsafe response when raising an exception in ApplicationController up vote 1 down vote favorite In my API I use Rails' exceptions_app to handle all exceptions and make a standard JSON response. This works fine except when I raise an exception in the ApplicationController. The controller ruby exception handling looks like this: class ApplicationController < ActionController::Base before_filter :raise_exception def raise_exception raise ActiveRecord::RecordNotFound end end When I request any page I would expect to get a 404 status response. Instead of this Rails returns a 500 status. The log shows this error message: Error during failsafe response: ActiveRecord::RecordNotFound What does this mean and how can I work around it? ruby-on-rails exception-handling share|improve this question edited Apr 2 '14 at 9:53 asked Apr 2 '14 at 9:42 TTT 1,61732552 Did you ever get this solved? –Andrew CP Kelley Aug 1 '14 at 21:40 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote In your config/application.rb, see if the line below is commented out. If it isn't, comment it out and see if the error still persist. config.exceptions_app = self.routes share|improve this answer answered Aug 1 '14 at 21:46 Andrew CP Kelley 419212 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn
Rack Middleware
more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Rails logging error: “Error during failsafe response: Shifting failed.” … is http://stackoverflow.com/questions/22807440/error-during-failsafe-response-when-raising-an-exception-in-applicationcontrolle there an elegant solution to this? up vote 2 down vote favorite I've configured my Rails 2.3.8 logger in the environment.rb to rotate daily: config.logger = Logger.new("#{RAILS_ROOT}/logs/#{RAILS_ENV}.log", 'daily') and every day in the morning I get the usual: Error during failsafe response: Shifting failed. Is there a decent/elegant/better solution to this? What I've done in the past is just set up a cron job to notice when this https://stackoverflow.com/questions/3398613/rails-logging-error-error-during-failsafe-response-shifting-failed-is-t happens and to drop a Passenger restart.txt file in the app's tmp/ directory. Thanks. ruby-on-rails ruby logging system-administration passenger share|improve this question asked Aug 3 '10 at 16:32 Amy 6853821 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted It's pretty common on UNIX/Linux to use a program named logrotate to perform log file rotation. Slicehost have a couple of nice articles on how to use it. For a Phusion Passenger deployment you can use a configuration like the example below. Obviously adjust the directories and rotation frequency as appropriate. /home/deploy/public_html/railsapp/shared/log/*.log { weekly missingok rotate 30 compress delaycompress notifempty sharedscripts postrotate touch /home/deploy/public_html/railsapp/current/tmp/restart.txt endscript } share|improve this answer answered Aug 3 '10 at 16:47 John Topley 73.4k37161219 Thanks, I'll check that out. –Amy Aug 3 '10 at 17:07 Yep. That worked! Some notes in the form of a blog post: blog.seqmedia.com/?p=216 –Amy Aug 3 '10 at 21:03 The blog post moved to: seqmedia.com/2010/08/03/… –Amy Apr 19 '12 at 21:44 add a comment| up vote 0 down vote If you have many requests coming in simultaneously, and it is time for the Rails to rotate logs. If a stream is trying to writ
Sign in Pricing Blog Support Search GitHub This repository https://github.com/richpeck/exception_handler/issues/1 Watch 11 Star 198 Fork 35 richpeck/exception_handler Code Issues 7 Pull requests 3 Projects 0 Wiki Pulse Graphs New issue Both 404's and 500's error message's not working through exception_handler gem correclty #1 Closed toymachiner62 opened this Issue Jun 10, 2014 · 24 comments Projects None error during yet Labels None yet Milestone No milestone Assignees No one assigned 5 participants toymachiner62 commented Jun 10, 2014 I'm only seeing the error message: 500 Internal Server Error If you are the administrator of this website, then please read this web application's error during fail log file and/or the web server's log file to find out what went wrong. When hitting both a 404, or a 500 error. Here's a stacktrace for my app. ActiveRecord::RecordNotFound (Couldn't find User with 'id'=12 [WHERE users.account_id = ?]): app/controllers/users_controller.rb:10:in `show' Processing by ExceptionHandler::ExceptionController#show as HTML Parameters: {"id"=>"12"} Account Load (0.4ms) SELECT accounts.* FROM accounts WHERE accounts.subdomain = 'ematoda' ORDER BY accounts.id ASC LIMIT 1 Rendered exception_handler/exception/show.html.erb within layouts/application (0.1ms) (0.5ms) SELECT COUNT(*) FROM roles INNER JOIN users_roles ON roles.id = users_roles.role_id WHERE users_roles.user_id = 1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))) Completed 500 Internal Server Error in 104ms Error during failsafe response: This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check. /Users/tomcaflisch/.rvm/gems/ruby-2.1.1@trakd/gems/cancan-1.6.10/lib/cancan/controller_additions.rb:261:in block in check_authorization'
/Users/tomcaflisch/.rvm/gems/ruby-2.1.1@trakd/gems/activesupport-4.1.0.rc1/lib/active_support/callbacks.rb:440:ininstance_exec' /Users/tomcaflisch/.rvm/gems/ruby-2.1.1@trakd/gems/activesupport-4.1.0.rc1/lib/active_support/callbacks.rb:440:in block in make_lambda'
/Users/tomcaflisch/.rvm/gems/ruby-2.1.1@trakd/gems/activesupport-4.1.0.rc