search for: rescue_action_in_public

Displaying 20 results from an estimated 50 matches for "rescue_action_in_public".

2006 Feb 16
3
rescue_action_in_public question
I''m using the rescue_action_in_public example from the Agile book to handle errors and email serious ones to me. In my application.rb controller: def rescue_action_in_public(exception) logger.error("rescue_action_in_public executed") case exception when ActiveRecord::RecordNotFound, ActionController::RoutingErro...
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
...ception is not caught by rails, causing the spec example to fail since the exception propagates out of the controller into the spec. >From googling around I get that rails only handles the exceptions and does a 404 response when it''s run in production mode, and that you need to call rescue_action_in_public! in your example if you want this behavior for test mode. However, this does not seem to do anything for me. The example still fails because the exception bubbles escapes unhandled from the controller. Do I need to set something up for the rescue_action_in_public! to work? Or is this not the cor...
2006 Feb 07
1
AWDWR: NameError (uninitialized constant UnknownAction) in rescue_action_in_public
I copied (and modified) this code from AWDWR: def rescue_action_in_public(exception) case exception when ActiveRecord::RecordNotFound, ActionController::UnknownAction render :template=>''/error'', :layout=>''application'', :status=>''404 Not Found'' else render :template=>''/error'', :...
2007 Jan 11
0
writing tests for rescue_action_in_public
I''m having trouble with rescue_action_in_public, both in getting it to work right in my rails app, and in writing tests to make sure. What I ultimately want to do is test for what a normal user would see when an error is trapped. I override local_request? like so: application.rb -------------- def rescue_action_in_public(exception) re...
2008 Jan 08
0
How do I call the exception_notifier from my own rescue_action_in_public ?
Hi all! I''ve been using the excellent exception_nofitier ( http://agilewebdevelopment.com/plugins/exception_notifier ) a while now, but want to change the way it interacts with my application. I now have my own rescue_action_in_public which takes me to a "Error. Describe the problem"-page. After filling out some user data the user can then click on submit. This is where the problem comes: I want to trigger the exception_notifier when I submit my form. I have tried to save the variables exception and request and then s...
2010 Aug 09
0
Exceptions in functional tests (rescue_action_in_public! broken?)
In 2.3, exceptions raised by controllers under functional tests were by default propagated to the test, but by using rescue_action_in_public! a test could trigger the production, public behavior and then use assert_response or similar to test the expected result. This was implemented via coordination between ActionController::Rescue and ActionController::TestCase::RaiseActionExceptions. This coordination is no longer present in 3.0.0.r...
2006 Nov 08
0
routing error does not get caught by rescue_action_in_public
I have this in my application controller. def rescue_action_in_public(exception) logger.error("rescue_action_in_public executed") case exception when ActiveRecord::RecordNotFound, ::ActionController::UnknownAction, ::ActionController::RoutingError logger.warn("rendering 404 page")...
2006 Feb 16
0
rescue_action_in_public in development environment?
hi, i''m trying to implement rescue_action_in_public as a catch-all to redirect to an error page when an exception is thrown (actually, just for testing, I''m rendering "ERROR"). However, putting def render_action_in_public render( :text=>"ERROR" ) end in either a specific controller or even application.rb, ha...
2011 Mar 16
1
Help overriding rescue_action_in_public in Rails 3
...ke so: # ApplicationController.rb protected def render_optional_error_file(status_code) render :template => "errors/500", :status => 500, :layout => ''application'' end However, Rails 3 no longer has render_optional_error_file. Instead, you need to overriderescue_action_in_public, which I do: # config/initializers/error_page.rb module ActionDispatch class ShowExceptions protected def rescue_action_in_public(exception) status = status_code(exception).to_s template = ActionView::Base.new(["#{Rails.root}/app/views"]) if [&qu...
2006 Jul 31
0
rescue_action_in_public useless to capture low level errors
Hi all, I''m trying to make for nicer system error handling, with the help of rescue_action_in_public (see Recipe 47, in ''Rails Recipes'') PROBLEM: While it lets me capture an incorrect db name in database.yml (for example), with lower level errors like when the DB server is just down, I still get the default system error screen for MySQL::ERROR : Can''t connect to...
2006 Feb 08
2
NameError (uninitialized constant UnknownAction)
...m having a strange problem that only seems to be happening on our production server. I never get this error locally but get it quite often on the server. The other odd thing is it doesn''t seem to be resulting in any error pages on the site. Everything looks fine... I wanted to add a rescue_action_in_public to email me when there are errors. So I followed the example from the agile book (p. 464). Pretty much word for word. Here''s the error I''m occasionally seeing in the production.log. Any ideas as to why it thinks ActionController::UnknownAction is uninitialized? NameError...
2007 Sep 08
1
Unknown Action doesn't raise exception ?
As I am in development environment, I wrote in my config/environment.rb ActionController::Base.consider_all_requests_local = false in my application.rb, I wrote def rescue_action_in_public(exception) case exception when RoutingError, UnknownAction render :file => "#{RAILS_ROOT}/public/404.html", :status => 404 else logger.error "Error raised: " + exception.to_s render :file => "#{RAILS_ROOT}...
2006 Feb 03
2
testing to see if emails are sent out on exceptions
Hi, I''m using ActionController::rescue_action_in_public() to send emails when uncaught exceptions happen. Is it possible to write tests for that? Joe
2005 Dec 18
2
Default routes for unknown actions
Hi folks- I have the following map for default ''junk'' routes: map.connect ''*anything'', :controller => ''welcome'', :action => ''unknown'' Which works just fine for a URL like: "mysite.com/junkjunkjunk" However, it still tries to resolve an action when I do: "mysite.com/my_controller/junkjunkjunk"
2009 Feb 04
2
rendering error page for "Unauthorized" from before_filter
...ule a bit so that I surely get the ''public'' view of the exception: def rescue_action_without_handler(exception) (...) if false && (consider_all_requests_local || local_request?) # here rescue_action_locally(exception) else rescue_action_in_public(exception) end (...) That did not change anything, either. Am I not doing the proper thing? Should I throw an exception (which one?) instead of rendering something and setting the http status code of the response? Or is rendering from before_filters a syntactic vinegar type of thing?...
2009 Aug 14
9
Rescuing from REXML::ParseException
...llo, When I call an action with some invalid XML or JSON data a parse exception gets raised from within Rails/Ruby (REXML or ActiveSupport::JSON). The problem that I''ve got is how to handle these exceptions. In my application_controller.rb I have the following for debugging purposes: def rescue_action_in_public(exception) respond_to do |request| request.all { render :text => "Uh oh" } end end and the same for #rescue_action_locally. It seems that if the Content- Type header of the request is set to application/xml or application/ json then Rails ignores my exception rescuing code and...
2007 Jul 21
3
manging rescues
What''s the recommended way to catch errors like this: NoMethodError in Register#confirm Showing app/views/register/confirm.rhtml where line #4 raised: undefined method `namen'' for nil:NilClass I get this error when someone does somethinh like: http://.........../register/confirm?email=jkdsfadslkjflksd If I make: remail = params[:email] @user = Request.find(:first,
2011 Feb 17
3
Handling InvalidAuthenticityToken from bots
I''m using exception_notifier to get an email when a 500 error occurs in production. Lately I''m seeing a lot of nonsensical POSTs show up that cause an InvalidAuthenticityToken error. All the fields contain random characters. (For instance, "search_title"=>"BHQWTZpjGeb") Is there a way to detect them and not send the email, while still sending the email in
2008 Sep 02
4
Rescue rails errors
Hi all, Sometime, I get the following error in my application: ActionController::InvalidAuthenticityToken in ManageController#site_servers ActionController::InvalidAuthenticityToken I tried to put the code in manage controller between begin ... rescue ... end but it didn''t catch the error. So I tried in the application.rb controller, I put the forgery code between begin ... rescue ...
2005 Dec 11
7
Catching Exceptions in ActionController
I''d like to be able to catch ActionController::MissingTemplate exceptions from within ActionControlle, *but*, MissingTemplate isn''t defined within my controllers!!! How is that possible - after all, all controller subclass ActionController, so how are exceptions it defines not there!? More importantly, how can I do this? -- Posted via http://www.ruby-forum.com/.