# How to Know What Exception a Method Will Raise?

**URL:** <https://www.ruby-forum.com/t/how-to-know-what-exception-a-method-will-raise/174843>\
**Category:** Ruby\
**Created:** [September 3, 2009, 1:05am UTC](https://www.ruby-forum.com/t/how-to-know-what-exception-a-method-will-raise/174843 "2009-09-03T01:05:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaggotChild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MaggotChild](https://www.ruby-forum.com/u/MaggotChild)\
**Post date:** [September 3, 2009, 1:05am UTC](https://www.ruby-forum.com/t/how-to-know-what-exception-a-method-will-raise/174843/1 "2009-09-03T01:05:05Z")

</div>

How is one supposed to know what exception (if any) a method will  
raise? The docs for all of the core Ruby classes I’ve seen fail to  
mention this.

---

<div class="post-metadata">

**Author:** ![MaggotChild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MaggotChild](https://www.ruby-forum.com/u/MaggotChild)\
**Post date:** [September 3, 2009, 1:17am UTC](https://www.ruby-forum.com/t/how-to-know-what-exception-a-method-will-raise/174843/2 "2009-09-03T01:17:58Z")

</div>

El Jueves, 3 de Septiembre de 2009, MaggotChild  
escribió:\> How is one supposed to know what exception (if any) a method will

> raise? The docs for all of the core Ruby classes I’ve seen fail to  
> mention this.

Each method should explain in the doc which exception could generate and  
in  
which cases.
