# Dynamic Error Pages

**URL:** <https://www.ruby-forum.com/t/dynamic-error-pages/81818>\
**Category:** Rails\
**Created:** [January 15, 2007, 9:41am UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818 "2007-01-15T09:41:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [January 15, 2007, 9:41am UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/1 "2007-01-15T09:41:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/2 "2007-01-19T16:31:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [January 19, 2007, 6:17pm UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/3 "2007-01-19T18:17:51Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [September 25, 2007, 10:42pm UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/4 "2007-09-25T22:42:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [September 25, 2007, 10:53pm UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/5 "2007-09-25T22:53:05Z")

</div>

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](http://www.nabble.com/-Rails--Dynamic-Error-Pages-tf3013402.html#a8376254)  
Sent from the RubyOnRails Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![eizesus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@eizesus](https://www.ruby-forum.com/u/eizesus)\
**Post date:** [September 25, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/dynamic-error-pages/81818/6 "2007-09-25T22:45:41Z")

</div>

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.
