How to handle errors thrown by Shell.rb



I have this very simple code

require ‘shell’
shell =
shell.transact do"#{path}")

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,