How I can trap FTPPermError?


#1

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