defining own exceptions in rails

Hi,

I would like to define my own exceptions in rails. I would like these definitions to be available throughout my application. What's an elegant/good way to do this? The only way I can think of doing this is by putting all of my exception definitions in config/environment.rb,. Is there a better/standard way of doing this? Thanks!

--Andrei

andreim wrote:

Hi,

I would like to define my own exceptions in rails. I would like these definitions to be available throughout my application. What's an elegant/good way to do this? The only way I can think of doing this is by putting all of my exception definitions in config/environment.rb,. Is there a better/standard way of doing this? Thanks!

--Andrei

I'd say create an exceptions.rb in the lib/ directory of your rails application. The only "not nice" thing about that is that you still have to call require 'exceptions' from your environment.rb. You could do the same thing, without having to add configuration to environment.rb, by turning it into a plugin.