# Re: Yet another question on exceptions

**URL:** <https://www.ruby-forum.com/t/re-yet-another-question-on-exceptions/53586>\
**Category:** Ruby\
**Created:** [February 10, 2006, 5:10pm UTC](https://www.ruby-forum.com/t/re-yet-another-question-on-exceptions/53586 "2006-02-10T17:10:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c57346/32.png) [@Gennady\_B](https://www.ruby-forum.com/u/Gennady_B)\
**Post date:** [February 10, 2006, 5:10pm UTC](https://www.ruby-forum.com/t/re-yet-another-question-on-exceptions/53586/1 "2006-02-10T17:10:12Z")

</div>

File.open is not that stupid ;-). It uses “ensure” internally to close  
a file in the case of exception. Using block with open guarantees that  
the file will not remain open no matter what.

Gennady.
