Given the explanation in the previous posts, you can redirect the standard error coming from the ftp command to a file, then check if the file has a size greater than zero and act accordingly, as in
ftp -inv << EOF 2> ftp.error
user USER PASSWORD
test -s ftp.error && echo Failed || rm ftp.error
Furthermore you can parse the content of the file (if any) and take different actions upon different error messages.