Forum: Ruby How I can trap FTPPermError ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mongeta 9. (Guest)
on 2009-03-13 10:07
Hello,


I'm trying to access an FTP tp check if the files from database exists
there, and if they have valid size.

Some of them are wrong files with zero kbytes.

My script stops with:

10944/10948 11978 inf_A78028800_12032009153806.pdf VOS200-SAL04

Net::FTPPermError: 550 Can't check for file existence

I want to trap the FTPPermError and continue with other files ...

I've tried with:

FTPPermError
Net::FTPPermError

witha Rescue but the scripts stops and those rescues doesn't fire ...

thanks!

r.


...

begin

  size=ftp.size(file_name)
  print "File size file: "+size.to_s+"\n"

  ftp.getbinaryfile(file_name, file_name_result, 1024)


  rescue FTPPermError, NameError => aaaapppppoooooo
    return false

  rescue Net::FTPPermError, NameError => ooooops
  return false


  rescue StandardError, NameError => boom
   # print "Error while downloading: " + boom
  #status=false
  return false

  end

...
This topic is locked and can not be replied to.