Each failure has an attached error code. The write stream, if the file is saved to the disk, returns the file path into the error.file property. The rest of the failures, return the URL of the request, as error.url. Note that the error.url property contains the parsed URL information.
Besides the actual FTP error codes, the error codes are:
The errors involving the FTP itself are passed back to the completion callback as the error argument. Non-recoverable errors (eg: coding errors on your end) throw exceptions. For the moment, the errors are thrown for these cases: