similar to: Taking Control of Un-handled Exceptions

Displaying 20 results from an estimated 2000 matches similar to: "Taking Control of Un-handled Exceptions"

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::RoutingError, ActionController::UnknownAction
2006 Feb 08
2
NameError (uninitialized constant UnknownAction)
Hi, I''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
2009 Dec 25
18
rescue_from ActionController::RoutingError II
OK ... so I''m not supposed to use it but ... Why doesn''t rescue_from ActionController::RoutingError work witht he code from http://www.rubyplus.org/episodes/20-Extended-RESTful-Authentication-Rails-2-App.html class ApplicationController < ActionController::Base helper :all # include all helpers, all the time # See ActionController::RequestForgeryProtection for details
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
2006 Mar 07
17
Handling Erros from AWDWR
I''m getting to the point now where I really need to start trapping the errors. So from my AWDWR book, I added the following directly from the book into application.rb... def rescue_action_in_public(exception) case exception when ActiveRecord::RecordNotFound, ActionController::UnknownAction render(:file => "#{RAILS_ROOT}/public/404.html",
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/.
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'',
2008 Apr 30
7
rescue_from issue with AWS - uninitialized constant
The new rescue_from in edge rails seems to conflict with ActionWebService, which I need for various other purposes. When I define, for example (with AWS gem installed): <b>rescue_from ActionController::RoutingError, :with => :page_not_found</b> I get the exception: <b>uninitialized constant ActionWebService::Dispatcher::ActionController::Base</b> OK, so AWS
2007 Jan 20
1
Missing action error not being caught
I keep getting a blank page containing only the following: "There was a controller specfic error processing your request." Though I have the following in my application.rb def rescue_action_in_public(exception) case exception when UnknownAction, ActiveRecord::RecordNotFound then render :controller => "application", :action =>
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") render(:file =>
2006 Sep 02
1
custom error handling
Please forgive me if this is a stupid question. If it has been answered already, please point me to the answer, as my searching has been fruitless. How can I programatically handle 404s and 500s when using Mongrel? I''ve read about using a proxy server config (.htaccess for example) to render an ErrorDocument rather than whatever comes from Rails, but I need something different. I would
2007 Jan 19
6
Problem w/ routes.rb
I am trying to develop a new webapp using Rails 1.2.1. I am installing it onto a production web server running Apache w/ fastcgi. The server already has some older webapps running on it using an older version of Rails. The apps are not installed in the document root; they each have their own subdirectory which is a symlink for the apache document root to the "public" directory of each
2006 Feb 26
0
rescue_action with RoutingError not loading ApplicationController/ApplicationHelper
Why is it that when rescue_action is called with any exception except for RoutingError, "self" refers to a controller within my application, but when there''s a RoutingError, "self" refers to an object of ActionController::Base? This makes some sense because a "RoutingError" implies that no controller was found to process the request. However, I am trying to
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"
2006 Mar 21
2
Several ''app'' directories ?
Hello, I''m new to ROR and my first wonder is to understand how to organize my application "per module"... Imagine I want to build a web site including : - the web site by itself - a forum - a wiki - a shop I would like to avoid putting all the controllers, views and models in the same app directories, polluting the subdirs with prefixed files like wiki_*, shop_*, forum_* -
2009 Aug 14
9
Rescuing from REXML::ParseException
Hello, 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 =>
2009 Jul 28
1
[PATCH ovirt-node] Removed subpackages, stateful, stateless, logos, and selinux for inclusuion in Fedora
rhbz#:51422 --- ovirt-node.spec.in | 149 +++++++++------------------------------------------ 1 files changed, 27 insertions(+), 122 deletions(-) diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 3138011..b4e660d 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -43,76 +43,23 @@ Requires: nc Requires: grub Requires: /usr/sbin/crond Requires: anyterm
2007 Dec 12
3
undefined method: controller_name
With rspec 1.0.8 I have a spec in the directory: spec/units/controllers/application_controller_spec.rb require File.dirname(__FILE__) + ''/../../spec_helper'' class DummyController < ApplicationController def index raise "Prevent index from rendering" end end describe ApplicationController, "Handling errors in production", :behaviour_type =>
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) render :text => "oops" end def
2005 Dec 28
2
where is WEBrick (daemon mode) output? not in log/server.log
I am running WEBrick in daemon mode (with the -d option). Where is the server output that would ordinarily be on my console if I ran without the -d option? APP_ROOT/log/server.log is empty and not being appended to, though it is owned by the same user WEBrick is running as and has write permissions. The only files in APP_ROOT/log are: development.log production.log server.log test.log Where