How to handle errors thrown by Shell.rb

Discussion in 'Ruby' started by Nick Snels, Jan 25, 2006.

  1. Nick Snels

    Nick Snels Guest

    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

    --
    Posted via http://www.ruby-forum.com/.
     
    Nick Snels, Jan 25, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fyleow
    Replies:
    1
    Views:
    296
    Ben Finney
    Jun 14, 2006
  2. Phil Johnson
    Replies:
    2
    Views:
    1,267
    Phil Johnson
    Mar 7, 2008
  3. yawnmoth
    Replies:
    97
    Views:
    4,775
    Bent C Dalager
    Feb 27, 2009
  4. hemant
    Replies:
    1
    Views:
    158
    Robert Klemme
    Sep 18, 2006
  5. Replies:
    1
    Views:
    198
    James Kanze
    Sep 2, 2013
Loading...

Share This Page