diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-12-01 21:26:58 +0900 |
| commit | f0f4f8f703b8c927fe8008daecb2d0547d486973 (patch) | |
| tree | aa9f93e55f375f342cc72fb62b5d1cca240c07be /src/FtpNegotiationCommand.cc | |
| parent | 6bc215fcec22d8bdf760c78cc25cb8798266c8a5 (diff) | |
Added more error code values.
I have not set error code for all exception invocation.
In this change, I set error code where error likely occurs.
Diffstat (limited to 'src/FtpNegotiationCommand.cc')
| -rw-r--r-- | src/FtpNegotiationCommand.cc | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/FtpNegotiationCommand.cc b/src/FtpNegotiationCommand.cc index 2a18f7ac..626d2a75 100644 --- a/src/FtpNegotiationCommand.cc +++ b/src/FtpNegotiationCommand.cc @@ -72,6 +72,7 @@ #include "HttpResponse.h" #include "DlRetryEx.h" #include "CheckIntegrityEntry.h" +#include "error_code.h" namespace aria2 { @@ -154,7 +155,7 @@ bool FtpNegotiationCommand::recvGreeting() { return false; } if(status != 220) { - throw DL_ABORT_EX(EX_CONNECTION_FAILED); + throw DL_ABORT_EX2(EX_CONNECTION_FAILED, error_code::FTP_PROTOCOL_ERROR); } sequence_ = SEQ_SEND_USER; @@ -183,7 +184,8 @@ bool FtpNegotiationCommand::recvUser() { sequence_ = SEQ_SEND_PASS; break; default: - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } return true; } @@ -204,7 +206,8 @@ bool FtpNegotiationCommand::recvPass() { return false; } if(status != 230) { - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } sequence_ = SEQ_SEND_TYPE; return true; @@ -226,7 +229,8 @@ bool FtpNegotiationCommand::recvType() { return false; } if(status != 200) { - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } sequence_ = SEQ_SEND_PWD; return true; @@ -251,7 +255,8 @@ bool FtpNegotiationCommand::recvPwd() return false; } if(status != 257) { - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } ftp_->setBaseWorkingDir(pwd); A2_LOG_INFO(fmt("CUID#%lld - base working directory is '%s'", @@ -295,7 +300,8 @@ bool FtpNegotiationCommand::recvCwd() throw DL_ABORT_EX2(MSG_RESOURCE_NOT_FOUND, error_code::RESOURCE_NOT_FOUND); else - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } cwdDirs_.pop_front(); if(cwdDirs_.empty()) { @@ -461,9 +467,10 @@ bool FtpNegotiationCommand::recvSize() { if(status == 213) { if(size > INT64_MAX) { - throw DL_ABORT_EX + throw DL_ABORT_EX2 (fmt(EX_TOO_LARGE_FILE, - util::uitos(size, true).c_str())); + util::uitos(size, true).c_str()), + error_code::FTP_PROTOCOL_ERROR); } if(!getPieceStorage()) { @@ -563,7 +570,8 @@ bool FtpNegotiationCommand::recvPort() { return false; } if(status != 200) { - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } sequence_ = SEQ_SEND_REST; return true; @@ -624,7 +632,8 @@ bool FtpNegotiationCommand::recvPasv() { return false; } if(status != 227) { - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } dataConnAddr_ = dest; @@ -744,8 +753,9 @@ bool FtpNegotiationCommand::sendRestPasv(const SharedHandle<Segment>& segment) { // Check connection is made properly if(dataSocket_->isReadable(0)) { std::string error = dataSocket_->getSocketError(); - throw DL_ABORT_EX - (fmt(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str())); + throw DL_ABORT_EX2 + (fmt(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str()), + error_code::FTP_PROTOCOL_ERROR); } setReadCheckSocket(getSocket()); disableWriteCheckSocket(); @@ -800,7 +810,8 @@ bool FtpNegotiationCommand::recvRetr() { throw DL_ABORT_EX2(MSG_RESOURCE_NOT_FOUND, error_code::RESOURCE_NOT_FOUND); else - throw DL_ABORT_EX(fmt(EX_BAD_STATUS, status)); + throw DL_ABORT_EX2(fmt(EX_BAD_STATUS, status), + error_code::FTP_PROTOCOL_ERROR); } if(getOption()->getAsBool(PREF_FTP_PASV)) { sequence_ = SEQ_NEGOTIATION_COMPLETED; |
