Displaying 20 results from an estimated 6000 matches similar to: "How to render my own error pages correctly?"
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
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
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
Hello,
I''m new to rails and I''m trying to wrap my heads around how to spec
controllers using RSpec (using rails 3rc1 and rspec 2.0.0.beta.19).
The problem I''ve run into is when I want to test that my controllers respond
with a 404 for unfound records.
Whenever I run the spec, the ActiveRecord::RecordNotFound exception is not
caught by rails, causing the spec
2015 Sep 14
2
inlining in exception handing region
I observed about +6% performance improvement in one of c++ tests in
spec2006 in AArch64 by avoiding inlining functions in exception handling
region. I guess this is not really rare because programers often make
small methods with throw statement like fCallee() in below sample c++
code.
Thanks,
Jun
> Hi Jun,
>
> It's a very common that C++ exception handling code blow up the
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 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'',
2011 Mar 16
1
Help overriding rescue_action_in_public in Rails 3
In Rails 2.3.x, you can override render_optional_error_file like 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:
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
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
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
2006 Jul 04
0
ActionController::UnknownAction hangs application
I''m trying to override rescue_action_in_public() using the PP example,
but my application hangs every time I generate an error.
def rescue_action_in_public(exception)
case exception.class
when ActiveRecord::RecordNotFound,
ActionController::UnknownAction
render( :file => "#{RAILS_ROOT}/public/404.html",
:status => "404 Not
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 Feb 04
2
rendering error page for "Unauthorized" from before_filter
Hey all,
I am writing a plugin in which I want to stop the rendering of an
action with an unauthorized response if the user is not authorized to
view the resource. I am using a before filter to achieve this and
inside that before filter I do it like so:
render :text => "Unauthorized!", :status => :unauthorized, :layout
=> false
The status is properly set since I see the
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 May 11
0
rescue action doesn''t catch exception
I define rescue_action_in_public method in my application controller.
But it fails to catch any exception thrown. I could catch the exception
if i define rescue_action method instead of rescue_action_in_public
method.
Any idea why?
Thanks,
Andy.
--
Posted via http://www.ruby-forum.com/.
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, has
no effect on the app redirecting on
2011 Jul 21
0
[LLVMdev] Catching exceptions passed through a JIT ExecutionEngine
On Tue, Jul 12, 2011 at 07:25:16PM -0400, Peter Zion said
> Hi All,
>
> I'm trying to catch an exception that is "passed through" an LLVM ExecutionEngine but I am unable to do so. Specifically, in C++ code, inside a try/catch block, I call a JITted function, which in turn calls back into my code. Everything works fine unless an exception is thrown; I would except the
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 :
2011 Jul 21
0
[LLVMdev] Catching exceptions passed through a JIT ExecutionEngine
Sorry Peter, just saw this.
If you are still having the problem:
Did you set: llvm::JITExceptionHandling = true; ?
Garrison
On Jul 12, 2011, at 19:25, Peter Zion wrote:
> Hi All,
>
> I'm trying to catch an exception that is "passed through" an LLVM ExecutionEngine but I am unable to do so. Specifically, in C++ code, inside a try/catch block, I call a JITted function,
2011 Jul 12
5
[LLVMdev] Catching exceptions passed through a JIT ExecutionEngine
Hi All,
I'm trying to catch an exception that is "passed through" an LLVM ExecutionEngine but I am unable to do so. Specifically, in C++ code, inside a try/catch block, I call a JITted function, which in turn calls back into my code. Everything works fine unless an exception is thrown; I would except the outermost try/catch(...) block to catch the exception thrown in my innermost