Dynamic Error Pages

HI all,

I am working on a huge project right now, and i wish to use dynamic
error pages (404, 500, etc.).
I followed the the tutorial on the Rails wiki and attached this code to
my application.rb:

def rescue_action_in_public(exception)
@exception = exception
render :file => ‘public/404.rhtml’, :layout => ‘picpongstore’
end

def local_request?
false
end

and to /config/enviroments/development.rb:

config.action_controller.consider_all_requests_local = false

anyway, 404 errors are handled great, but application-errors (aka 500)
are still displayed like before (text messages only).

any ideas?

On Mon, 2007-01-15 at 09:41 +0100, Elad M. wrote:

end
are still displayed like before (text messages only).

any ideas?

If you switch to rails-1.2 RC-2,

“Uncaught exceptions raised anywhere in your application will cause
RAILS_ROOT/public/500.html to be read and shown instead of just the
static “Application error (Rails).” So make it look nice if you aren’t
using it already!”

No more fooling around with rescue_action_in_public is required now.

Hemant K. wrote:

On Mon, 2007-01-15 at 09:41 +0100, Elad M. wrote:

end
are still displayed like before (text messages only).

any ideas?

If you switch to rails-1.2 RC-2,

“Uncaught exceptions raised anywhere in your application will cause
RAILS_ROOT/public/500.html to be read and shown instead of just the
static �Application error (Rails).� So make it look nice if you aren�t
using it already!”

No more fooling around with rescue_action_in_public is required now.

Ok, but this is an HTML file, not RHTML…

Anyone know why this was done and/or what the benefit is of it?

If you get a 500, you can’t be sure your server is really working right.
A
500 is a server error so your Rails app might be hosed. It’s probably
safer
to render an html page than try to rely on the app to do something
smart.

Jason N. wrote:

that’s not very DRY.


View this message in context:
http://www.nabble.com/-Rails--Dynamic-Error-Pages-tf3013402.html#a8376254
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

mmm,

but this is a 500.HTML, not RHTML. so i will not be able to use dynamic
data, or even layout.
that’s not very DRY.