# How to handle errors thrown by Shell.rb

**URL:** <https://www.ruby-forum.com/t/how-to-handle-errors-thrown-by-shell-rb/97441>\
**Category:** Ruby\
**Created:** [January 25, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/how-to-handle-errors-thrown-by-shell-rb/97441 "2006-01-25T23:04:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicksnels](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicksnels](https://www.ruby-forum.com/u/nicksnels)\
**Post date:** [January 25, 2006, 11:04pm UTC](https://www.ruby-forum.com/t/how-to-handle-errors-thrown-by-shell-rb/97441/1 "2006-01-25T23:04:19Z")

</div>

Hi,

I have this very simple code

require ‘shell’  
shell = Shell.new  
shell.transact do  
shell.cat("#{path}")  
end

Now suppose that the variable path is no longer available on disk or you  
don’t have permissions to access the file. How can I capture this error  
and provide a helpful message? I have already tried it with rescue  
Errno::EACCES but that didn’t work. Thanks.

Kind regards,

Nick
