# Custom 500/Application Errors

**URL:** <https://www.ruby-forum.com/t/custom-500-application-errors/146817>\
**Category:** Deployment\
**Created:** [August 25, 2008, 9:34pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817 "2008-08-25T21:34:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 25, 2008, 9:34pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/1 "2008-08-25T21:34:52Z")

</div>

Hi, I’m working on creating custom 500 errors in rails 2.1. Specifically  
I’m trying to send an email with the exception every time an application  
error occurs.

So I follow these instructions:

[http://wiki.rubyonrails.org/rails/pages/HandlingPreControllerErrors](http://wiki.rubyonrails.org/rails/pages/HandlingPreControllerErrors)

It tells me to put an error handler in /lib/ then require it in  
environment.rb.

HOWEVER, when I past it’s code, creating something called an  
“ActionController”, I can no longer start mongrel. Because of  
“uninitialized constant ActionController”

Whats the deal?

Please help!

Thank you

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 25, 2008, 10:14pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/2 "2008-08-25T22:14:18Z")

</div>

On Mon, Aug 25, 2008 at 12:34 PM, Alex Williams  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> environment.rb.
> 
> HOWEVER, when I past it’s code, creating something called an  
> “ActionController”, I can no longer start mongrel. Because of  
> “uninitialized constant ActionController”
> 
> Whats the deal?
> 
> Please help!

Alex,

There are a few options for this. The typical solution is to use the  
Exception Notification plugin.

- [GitHub - rails/exception\_notification: NOTICE: official repository moved to https://github.com/smartinez87/exception\_notification](http://github.com/rails/exception_notification/)

This plugin will let you define email recipients to direct  
exceptions/errors to. You can take a look at the README for  
instructions on installing and configuring.

Additionally, there are also a few web services that provide APIs that  
you can direct exceptions to. I’ve been a beta tester for Exceptional,  
which our team is using across five client projects in production  
right now with great success. You might look at this as a solution  
once they open it up to more customers.

- [http://getexceptional.com/](http://getexceptional.com/)

Another new comer to this arena is Hoptoad, which I haven’t had a  
chance to play with yet.

- [http://www.hoptoadapp.com/](http://www.hoptoadapp.com/)

Good luck!

Cheers,  
Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 25, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/3 "2008-08-25T23:05:44Z")

</div>

Robby R. wrote:

> On Mon, Aug 25, 2008 at 12:34 PM, Alex Williams  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > environment.rb.
> > 
> > HOWEVER, when I past it’s code, creating something called an  
> > “ActionController”, I can no longer start mongrel. Because of  
> > “uninitialized constant ActionController”
> > 
> > Whats the deal?
> > 
> > Please help!
> 
> Alex,
> 
> There are a few options for this. The typical solution is to use the  
> Exception Notification plugin.
> 
> - [GitHub - rails/exception\_notification: NOTICE: official repository moved to https://github.com/smartinez87/exception\_notification](http://github.com/rails/exception_notification/)
> 
> This plugin will let you define email recipients to direct  
> exceptions/errors to. You can take a look at the README for  
> instructions on installing and configuring.
> 
> Additionally, there are also a few web services that provide APIs that  
> you can direct exceptions to. I’ve been a beta tester for Exceptional,  
> which our team is using across five client projects in production  
> right now with great success. You might look at this as a solution  
> once they open it up to more customers.
> 
> - [http://getexceptional.com/](http://getexceptional.com/)
> 
> Another new comer to this arena is Hoptoad, which I haven’t had a  
> chance to play with yet.
> 
> - [http://www.hoptoadapp.com/](http://www.hoptoadapp.com/)
> 
> Good luck!
> 
> Cheers,  
> Robby
> 
> –  
> Robby R.  
> Chief Evangelist, Partner
> 
> PLANET ARGON, LLC  
> design // development // hosting
> 
> [http://www.planetargon.com/](http://www.planetargon.com/)  
> [http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
> aim: planetargon
> 
> +1 503 445 2457  
> +1 877 55 ARGON [toll free]  
> +1 815 642 4068 [fax]

Thank you for the Fast response. I am trying to install  
exception\_notifier. Now it isn’t working, but I have a feeling it’s  
something simple I just don’t know about.

I downloaded exception\_notifier and put it in my plugins folder like the  
reset of 'em are. I pasted the line:

include ExceptionNotifiable

in my application folder as asked.

then I added this to environment.rb:

ExceptionNotifier.exception\_recipients = %w(removed\_email\_address@domain.invalid  
removed\_email\_address@domain.invalid)

Essentially I was just testing defaults. However, I receive the error  
“uninitialized constant ExceptionNotifier”

So what do I need to do to get ExceptionNotifier working? It may be  
something I simply don’t understand about installing plugins this way.

Thank you I hope hear from you.

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 25, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/4 "2008-08-25T23:43:00Z")

</div>

Robby R. wrote:

> On Mon, Aug 25, 2008 at 2:05 PM, Alex Williams  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > > 
> > > 
> > > - [GitHub - rails/exception\_notification: NOTICE: official repository moved to https://github.com/smartinez87/exception\_notification](http://github.com/rails/exception_notification/)
> > > 
> > > Robby  
> > > [http://www.planetargon.com/](http://www.planetargon.com/)
> > 
> > I downloaded exception\_notifier and put it in my plugins folder like the  
> > reset of 'em are. I pasted the line:
> > 
> > include ExceptionNotifiable
> > 
> > in my application folder as asked.
> 
> Just to clarify… you meant application controller?
> 
> > Essentially I was just testing defaults. However, I receive the error  
> > “uninitialized constant ExceptionNotifier”
> 
> Hmm, I don’t think that you need to require this in your  
> environment.rb. It might not be initializing the plugin.
> 
> Robby
> 
> –  
> Robby R.  
> Chief Evangelist, Partner
> 
> PLANET ARGON, LLC  
> design // development // hosting
> 
> [http://www.planetargon.com/](http://www.planetargon.com/)  
> [http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
> aim: planetargon
> 
> +1 503 445 2457  
> +1 877 55 ARGON [toll free]  
> +1 815 642 4068 [fax]

Yes application controller, sorry 🙂

I’m follow the instructions from the website you posted. Here they are:

* * *

First, include the ExceptionNotifiable mixin in whichever controller you  
want  
to generate error emails (typically ApplicationController):

class ApplicationController \< ActionController::Base  
include ExceptionNotifiable  
…  
end

Then, specify the email recipients in your environment:

ExceptionNotifier.exception\_recipients = %w(removed\_email\_address@domain.invalid  
removed\_email\_address@domain.invalid)

## And that’s it! The defaults take care of the rest.

But again it isn’t initializing “ExceptionNotifier”, so what should I  
do?

I put the download right into the plugins folder so it looks like:

/plugins/exception\_notfier/  
lib  
test  
views  
INIT.rb  
README

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 25, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/5 "2008-08-25T23:19:55Z")

</div>

On Mon, Aug 25, 2008 at 2:05 PM, Alex Williams  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > 
> > 
> > - [GitHub - rails/exception\_notification: NOTICE: official repository moved to https://github.com/smartinez87/exception\_notification](http://github.com/rails/exception_notification/)
> > 
> > Robby  
> > [http://www.planetargon.com/](http://www.planetargon.com/)
> 
> I downloaded exception\_notifier and put it in my plugins folder like the  
> reset of 'em are. I pasted the line:
> 
> include ExceptionNotifiable
> 
> in my application folder as asked.

Just to clarify… you meant application controller?

> Essentially I was just testing defaults. However, I receive the error  
> “uninitialized constant ExceptionNotifier”

Hmm, I don’t think that you need to require this in your  
environment.rb. It might not be initializing the plugin.

Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [September 19, 2009, 2:18pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/6 "2009-09-19T14:18:41Z")

</div>

For anyone who happens across this searching for an answer (as I was)  
the solution is to restart the server. Seemed to do the trick in my  
case.

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [August 26, 2008, 8:31pm UTC](https://www.ruby-forum.com/t/custom-500-application-errors/146817/7 "2008-08-26T20:31:13Z")

</div>

Any ideas Robby?
