mirror of https://github.com/aria2/aria2
Added additional error_code::Values(9 through 14).
parent
d316a00ade
commit
ecbc05012c
|
@ -162,10 +162,11 @@ void AbstractDiskWriter::writeData(const unsigned char* data, size_t len, off_t
|
||||||
// If errno is ENOSPC(not enough space in device), throw
|
// If errno is ENOSPC(not enough space in device), throw
|
||||||
// DownloadFailureException and abort download instantly.
|
// DownloadFailureException and abort download instantly.
|
||||||
if(errNum == ENOSPC) {
|
if(errNum == ENOSPC) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_FILE_WRITE,
|
(fmt(EX_FILE_WRITE,
|
||||||
filename_.c_str(),
|
filename_.c_str(),
|
||||||
util::safeStrerror(errNum).c_str()));
|
util::safeStrerror(errNum).c_str()),
|
||||||
|
error_code::NOT_ENOUGH_DISK_SPACE);
|
||||||
} else {
|
} else {
|
||||||
throw DL_ABORT_EX
|
throw DL_ABORT_EX
|
||||||
(fmt(EX_FILE_WRITE,
|
(fmt(EX_FILE_WRITE,
|
||||||
|
|
|
@ -409,10 +409,11 @@ void DefaultBtProgressInfoFile::load()
|
||||||
src.setBitfield(savedBitfield, bitfieldLength);
|
src.setBitfield(savedBitfield, bitfieldLength);
|
||||||
if((src.getCompletedLength() || numInFlightPiece) &&
|
if((src.getCompletedLength() || numInFlightPiece) &&
|
||||||
!option_->getAsBool(PREF_ALLOW_PIECE_LENGTH_CHANGE)) {
|
!option_->getAsBool(PREF_ALLOW_PIECE_LENGTH_CHANGE)) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
("WARNING: Detected a change in piece length. You can proceed with"
|
("WARNING: Detected a change in piece length. You can proceed with"
|
||||||
" --allow-piece-length-change=true, but you may lose some download"
|
" --allow-piece-length-change=true, but you may lose some download"
|
||||||
" progress.");
|
" progress.",
|
||||||
|
error_code::PIECE_LENGTH_CHANGED);
|
||||||
}
|
}
|
||||||
BitfieldMan dest(dctx_->getPieceLength(), totalLength);
|
BitfieldMan dest(dctx_->getPieceLength(), totalLength);
|
||||||
util::convertBitfield(&dest, &src);
|
util::convertBitfield(&dest, &src);
|
||||||
|
|
|
@ -367,9 +367,10 @@ bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
|
||||||
getRequestGroup()->preDownloadProcessing();
|
getRequestGroup()->preDownloadProcessing();
|
||||||
if(getDownloadEngine()->getRequestGroupMan()->
|
if(getDownloadEngine()->getRequestGroupMan()->
|
||||||
isSameFileBeingDownloaded(getRequestGroup())) {
|
isSameFileBeingDownloaded(getRequestGroup())) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||||
getRequestGroup()->getFirstFilePath().c_str()));
|
getRequestGroup()->getFirstFilePath().c_str()),
|
||||||
|
error_code::DUPLICATE_DOWNLOAD);
|
||||||
}
|
}
|
||||||
if(totalLength == 0) {
|
if(totalLength == 0) {
|
||||||
|
|
||||||
|
|
|
@ -213,9 +213,10 @@ bool HttpResponseCommand::executeInternal()
|
||||||
getRequestGroup()->preDownloadProcessing();
|
getRequestGroup()->preDownloadProcessing();
|
||||||
if(getDownloadEngine()->getRequestGroupMan()->
|
if(getDownloadEngine()->getRequestGroupMan()->
|
||||||
isSameFileBeingDownloaded(getRequestGroup())) {
|
isSameFileBeingDownloaded(getRequestGroup())) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||||
getRequestGroup()->getFirstFilePath().c_str()));
|
getRequestGroup()->getFirstFilePath().c_str()),
|
||||||
|
error_code::DUPLICATE_DOWNLOAD);
|
||||||
}
|
}
|
||||||
// update last modified time
|
// update last modified time
|
||||||
updateLastModifiedTime(httpResponse->getLastModifiedTime());
|
updateLastModifiedTime(httpResponse->getLastModifiedTime());
|
||||||
|
|
|
@ -298,18 +298,20 @@ void RequestGroup::createInitialCommand
|
||||||
if(btRegistry->getDownloadContext(torrentAttrs->infoHash)) {
|
if(btRegistry->getDownloadContext(torrentAttrs->infoHash)) {
|
||||||
// TODO If metadataGetMode == false and each FileEntry has
|
// TODO If metadataGetMode == false and each FileEntry has
|
||||||
// URI, then go without BT.
|
// URI, then go without BT.
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt("InfoHash %s is already registered.",
|
(fmt("InfoHash %s is already registered.",
|
||||||
bittorrent::getInfoHashString(downloadContext_).c_str()));
|
bittorrent::getInfoHashString(downloadContext_).c_str()),
|
||||||
|
error_code::DUPLICATE_INFO_HASH);
|
||||||
}
|
}
|
||||||
if(metadataGetMode) {
|
if(metadataGetMode) {
|
||||||
// Use UnknownLengthPieceStorage.
|
// Use UnknownLengthPieceStorage.
|
||||||
initPieceStorage();
|
initPieceStorage();
|
||||||
} else {
|
} else {
|
||||||
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||||
downloadContext_->getBasePath().c_str()));
|
downloadContext_->getBasePath().c_str()),
|
||||||
|
error_code::DUPLICATE_DOWNLOAD);
|
||||||
}
|
}
|
||||||
initPieceStorage();
|
initPieceStorage();
|
||||||
if(downloadContext_->getFileEntries().size() > 1) {
|
if(downloadContext_->getFileEntries().size() > 1) {
|
||||||
|
@ -413,9 +415,10 @@ void RequestGroup::createInitialCommand
|
||||||
!option_->getAsBool(PREF_ALLOW_OVERWRITE) &&
|
!option_->getAsBool(PREF_ALLOW_OVERWRITE) &&
|
||||||
!option_->getAsBool(PREF_BT_SEED_UNVERIFIED)) {
|
!option_->getAsBool(PREF_BT_SEED_UNVERIFIED)) {
|
||||||
// TODO we need this->haltRequested = true?
|
// TODO we need this->haltRequested = true?
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(MSG_FILE_ALREADY_EXISTS,
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
||||||
downloadContext_->getBasePath().c_str()));
|
downloadContext_->getBasePath().c_str()),
|
||||||
|
error_code::FILE_ALREADY_EXISTS);
|
||||||
} else {
|
} else {
|
||||||
pieceStorage_->getDiskAdaptor()->openFile();
|
pieceStorage_->getDiskAdaptor()->openFile();
|
||||||
}
|
}
|
||||||
|
@ -477,9 +480,10 @@ void RequestGroup::createInitialCommand
|
||||||
createNextCommand(commands, e, 1);
|
createNextCommand(commands, e, 1);
|
||||||
} else {
|
} else {
|
||||||
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||||
downloadContext_->getBasePath().c_str()));
|
downloadContext_->getBasePath().c_str()),
|
||||||
|
error_code::DUPLICATE_DOWNLOAD);
|
||||||
}
|
}
|
||||||
SharedHandle<BtProgressInfoFile> progressInfoFile
|
SharedHandle<BtProgressInfoFile> progressInfoFile
|
||||||
(new DefaultBtProgressInfoFile
|
(new DefaultBtProgressInfoFile
|
||||||
|
@ -503,9 +507,10 @@ void RequestGroup::createInitialCommand
|
||||||
// In this context, multiple FileEntry objects are in
|
// In this context, multiple FileEntry objects are in
|
||||||
// DownloadContext.
|
// DownloadContext.
|
||||||
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
||||||
downloadContext_->getBasePath().c_str()));
|
downloadContext_->getBasePath().c_str()),
|
||||||
|
error_code::DUPLICATE_DOWNLOAD);
|
||||||
}
|
}
|
||||||
initPieceStorage();
|
initPieceStorage();
|
||||||
if(downloadContext_->getFileEntries().size() > 1) {
|
if(downloadContext_->getFileEntries().size() > 1) {
|
||||||
|
@ -526,9 +531,10 @@ void RequestGroup::createInitialCommand
|
||||||
if(!isCheckIntegrityReady() &&
|
if(!isCheckIntegrityReady() &&
|
||||||
!option_->getAsBool(PREF_ALLOW_OVERWRITE)) {
|
!option_->getAsBool(PREF_ALLOW_OVERWRITE)) {
|
||||||
// TODO we need this->haltRequested = true?
|
// TODO we need this->haltRequested = true?
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(MSG_FILE_ALREADY_EXISTS,
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
||||||
downloadContext_->getBasePath().c_str()));
|
downloadContext_->getBasePath().c_str()),
|
||||||
|
error_code::FILE_ALREADY_EXISTS);
|
||||||
} else {
|
} else {
|
||||||
pieceStorage_->getDiskAdaptor()->openFile();
|
pieceStorage_->getDiskAdaptor()->openFile();
|
||||||
}
|
}
|
||||||
|
@ -763,14 +769,16 @@ void RequestGroup::shouldCancelDownloadForSafety()
|
||||||
if(tryAutoFileRenaming()) {
|
if(tryAutoFileRenaming()) {
|
||||||
A2_LOG_NOTICE(fmt(MSG_FILE_RENAMED, getFirstFilePath().c_str()));
|
A2_LOG_NOTICE(fmt(MSG_FILE_RENAMED, getFirstFilePath().c_str()));
|
||||||
} else {
|
} else {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt("File renaming failed: %s",
|
(fmt("File renaming failed: %s",
|
||||||
getFirstFilePath().c_str()));
|
getFirstFilePath().c_str()),
|
||||||
|
error_code::FILE_RENAMING_FAILED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw DOWNLOAD_FAILURE_EXCEPTION
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
||||||
(fmt(MSG_FILE_ALREADY_EXISTS,
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
||||||
getFirstFilePath().c_str()));
|
getFirstFilePath().c_str()),
|
||||||
|
error_code::FILE_ALREADY_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,12 @@ enum Value {
|
||||||
NETWORK_PROBLEM = 6,
|
NETWORK_PROBLEM = 6,
|
||||||
IN_PROGRESS = 7,
|
IN_PROGRESS = 7,
|
||||||
CANNOT_RESUME = 8,
|
CANNOT_RESUME = 8,
|
||||||
|
NOT_ENOUGH_DISK_SPACE = 9,
|
||||||
|
PIECE_LENGTH_CHANGED = 10,
|
||||||
|
DUPLICATE_DOWNLOAD = 11,
|
||||||
|
DUPLICATE_INFO_HASH = 12,
|
||||||
|
FILE_ALREADY_EXISTS = 13,
|
||||||
|
FILE_RENAMING_FAILED = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace error_code
|
} // namespace error_code
|
||||||
|
|
Loading…
Reference in New Issue