# Exceptions available in Ruby on Rails

**URL:** <https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863>\
**Category:** Rails\
**Created:** [July 1, 2008, 8:00am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863 "2008-07-01T08:00:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [July 1, 2008, 8:00am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863/1 "2008-07-01T08:00:08Z")

</div>

Hi,

Can anybody list out what are all the exceptions available in ROR?

Thanks in advance…

Karthik.

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [July 1, 2008, 8:32am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863/2 "2008-07-01T08:32:52Z")

</div>

Karthi kn wrote:

> Hi,
> 
> Can anybody list out what are all the exceptions available in ROR?
> 
> Thanks in advance…
> 
> Karthik.

That’s a pretty open question.

What specifically do you need to know?

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [July 1, 2008, 9:08am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863/3 "2008-07-01T09:08:55Z")

</div>

> That’s a pretty open question.
> 
> What specifically do you need to know?

There is a class hierarchy in JAVA to see all the possible exceptions  
that can occur. Just like that, can I find what are all the possible  
exceptions that can occur in ROR. I need to list out all the exception  
names.

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [July 1, 2008, 11:08am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863/4 "2008-07-01T11:08:21Z")

</div>

> Well you can do  
> all\_exceptions = []  
> ObjectSpace.each\_object(Class) do |k|  
> all\_exceptions \<\< k if k.ancestors.include?(Exception)  
> end
> 
> Fred

I think that’s what I wanted. Thanks a lot Fred.

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [July 1, 2008, 11:04am UTC](https://www.ruby-forum.com/t/exceptions-available-in-ruby-on-rails/141863/5 "2008-07-01T11:04:31Z")

</div>

On 1 Jul 2008, at 08:08, Karthi kn wrote:

> > That’s a pretty open question.
> > 
> > What specifically do you need to know?
> 
> There is a class hierarchy in JAVA to see all the possible exceptions  
> that can occur. Just like that, can I find what are all the possible  
> exceptions that can occur in ROR. I need to list out all the exception  
> names.

Well you can do  
all\_exceptions = []  
ObjectSpace.each\_object(Class) do |k|  
all\_exceptions \<\< k if k.ancestors.include?(Exception)  
end

Fred
