diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-05-18 15:07:15 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-05-18 15:07:15 +0000 |
| commit | 20e215047c24ac5a63ff10d204003760811f2e2e (patch) | |
| tree | 872156b0b66279fae1977f0d66e14bc2824281d8 /src/AbstractDiskWriter.cc | |
| parent | ff83fc65df3e4ec128c8a8855829cec7cfb6c692 (diff) | |
2009-05-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added source filename(__FILE__) and line number(__LINE__) to
exception message.
* src/AbstractCommand.cc
* src/AbstractDiskWriter.cc
* src/AbstractProxyResponseCommand.cc
* src/BDE.h
* src/BtAllowedFastMessage.cc
* src/BtHandshakeMessageValidator.h
* src/BtHaveAllMessage.cc
* src/BtHaveNoneMessage.cc
* src/BtPieceMessage.cc
* src/BtRejectMessage.cc
* src/ChunkedDecoder.cc
* src/CookieStorage.cc
* src/DHTAnnouncePeerMessage.cc
* src/DHTEntryPointNameResolveCommand.cc
* src/DHTMessageFactoryImpl.cc
* src/DHTMessageTracker.cc
* src/DHTRoutingTableDeserializer.cc
* src/DHTRoutingTableSerializer.cc
* src/DHTSetup.cc
* src/DHTTokenTracker.cc
* src/DefaultBtAnnounce.cc
* src/DefaultBtContext.cc
* src/DefaultBtInteractive.cc
* src/DefaultBtMessageFactory.cc
* src/DefaultBtProgressInfoFile.cc
* src/DefaultExtensionMessageFactory.cc
* src/DlAbortEx.h
* src/DlRetryEx.h
* src/DownloadCommand.cc
* src/DownloadEngineFactory.cc
* src/DownloadFailureException.h
* src/Exception.cc
* src/Exception.h
* src/ExpatMetalinkProcessor.cc
* src/ExpatXmlRpcRequestProcessor.cc
* src/FallocFileAllocationIterator.cc
* src/FatalException.h
* src/FtpConnection.cc
* src/FtpFinishDownloadCommand.cc
* src/FtpInitiateConnectionCommand.cc
* src/FtpNegotiationCommand.cc
* src/GZipDecoder.cc
* src/HandshakeExtensionMessage.cc
* src/HttpConnection.cc
* src/HttpHeaderProcessor.cc
* src/HttpInitiateConnectionCommand.cc
* src/HttpResponse.cc
* src/HttpResponseCommand.cc
* src/HttpServer.cc
* src/HttpSkipResponseCommand.cc
* src/InitiateConnectionCommandFactory.cc
* src/IteratableChunkChecksumValidator.cc
* src/LibgcryptARC4Context.h
* src/LibgcryptARC4Decryptor.h
* src/LibgcryptARC4Encryptor.h
* src/LibgcryptDHKeyExchange.h
* src/LibgnutlsTLSContext.cc
* src/LibsslARC4Context.h
* src/LibsslARC4Decryptor.h
* src/LibsslARC4Encryptor.h
* src/LibsslDHKeyExchange.h
* src/LibsslTLSContext.cc
* src/MSEHandshake.cc
* src/MessageDigestHelper.cc
* src/MetalinkHelper.cc
* src/MultiDiskAdaptor.cc
* src/NameMatchOptionHandler.h
* src/NameResolver.cc
* src/Netrc.cc
* src/NsCookieParser.cc
* src/OptionHandlerException.cc
* src/OptionHandlerException.h
* src/OptionHandlerImpl.h
* src/OptionParser.cc
* src/ParameterizedStringParser.cc
* src/PeerAbstractCommand.cc
* src/PeerConnection.cc
* src/PeerMessageUtil.cc
* src/PeerReceiveHandshakeCommand.cc
* src/Platform.cc
* src/ReceiverMSEHandshakeCommand.cc
* src/RecoverableException.h
* src/RequestGroup.cc
* src/SimpleLogger.cc
* src/SocketCore.cc
* src/Sqlite3MozCookieParser.cc
* src/UTPexExtensionMessage.cc
* src/Util.cc
* src/XML2SAXMetalinkProcessor.cc
* src/Xml2XmlRpcRequestProcessor.cc
* src/XmlRpcMethodImpl.cc
* src/bencode.cc
* src/download_helper.cc
* src/messageDigest.h
* test/ExceptionTest.cc
* test/TestUtil.cc
Diffstat (limited to 'src/AbstractDiskWriter.cc')
| -rw-r--r-- | src/AbstractDiskWriter.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/AbstractDiskWriter.cc b/src/AbstractDiskWriter.cc index 779fdd80..32eeaf1f 100644 --- a/src/AbstractDiskWriter.cc +++ b/src/AbstractDiskWriter.cc @@ -88,7 +88,7 @@ void AbstractDiskWriter::closeFile() void AbstractDiskWriter::openExistingFile(uint64_t totalLength) { if(!File(_filename).exists()) { - throw DlAbortEx + throw DL_ABORT_EX (StringFormat(EX_FILE_OPEN, _filename.c_str(), MSG_FILE_NOT_FOUND).str()); } @@ -100,7 +100,7 @@ void AbstractDiskWriter::openExistingFile(uint64_t totalLength) } if((fd = open(_filename.c_str(), flags, OPEN_MODE)) < 0) { - throw DlAbortEx + throw DL_ABORT_EX (StringFormat(EX_FILE_OPEN, _filename.c_str(), strerror(errno)).str()); } } @@ -111,7 +111,7 @@ void AbstractDiskWriter::createFile(int addFlags) Util::mkdirs(File(_filename).getDirname()); if((fd = open(_filename.c_str(), O_CREAT|O_RDWR|O_TRUNC|O_BINARY|addFlags, OPEN_MODE)) < 0) { - throw DlAbortEx(StringFormat(EX_FILE_OPEN, + throw DL_ABORT_EX(StringFormat(EX_FILE_OPEN, _filename.c_str(), strerror(errno)).str()); } } @@ -140,7 +140,7 @@ ssize_t AbstractDiskWriter::readDataInternal(unsigned char* data, size_t len) void AbstractDiskWriter::seek(off_t offset) { if(lseek(fd, offset, SEEK_SET) == (off_t)-1) { - throw DlAbortEx + throw DL_ABORT_EX (StringFormat(EX_FILE_SEEK, _filename.c_str(), strerror(errno)).str()); } } @@ -152,10 +152,10 @@ void AbstractDiskWriter::writeData(const unsigned char* data, size_t len, off_t // If errno is ENOSPC(not enough space in device), throw // DownloadFailureException and abort download instantly. if(errno == ENOSPC) { - throw DownloadFailureException + throw DOWNLOAD_FAILURE_EXCEPTION (StringFormat(EX_FILE_WRITE, _filename.c_str(), strerror(errno)).str()); } - throw DlAbortEx(StringFormat(EX_FILE_WRITE, + throw DL_ABORT_EX(StringFormat(EX_FILE_WRITE, _filename.c_str(), strerror(errno)).str()); } } @@ -165,7 +165,7 @@ ssize_t AbstractDiskWriter::readData(unsigned char* data, size_t len, off_t offs ssize_t ret; seek(offset); if((ret = readDataInternal(data, len)) < 0) { - throw DlAbortEx(StringFormat(EX_FILE_READ, + throw DL_ABORT_EX(StringFormat(EX_FILE_READ, _filename.c_str(), strerror(errno)).str()); } return ret; @@ -174,7 +174,7 @@ ssize_t AbstractDiskWriter::readData(unsigned char* data, size_t len, off_t offs void AbstractDiskWriter::truncate(uint64_t length) { if(fd == -1) { - throw DlAbortEx("File not opened."); + throw DL_ABORT_EX("File not opened."); } #ifdef __MINGW32__ // Since mingw32's ftruncate cannot handle over 2GB files, we use SetEndOfFile @@ -182,12 +182,12 @@ void AbstractDiskWriter::truncate(uint64_t length) HANDLE handle = LongToHandle(_get_osfhandle(fd)); seek(length); if(SetEndOfFile(handle) == 0) { - throw DlAbortEx(StringFormat("SetEndOfFile failed. cause: %s", + throw DL_ABORT_EX(StringFormat("SetEndOfFile failed. cause: %s", GetLastError()).str()); } #else if(ftruncate(fd, length) == -1) { - throw DlAbortEx(StringFormat("ftruncate failed. cause: %s", + throw DL_ABORT_EX(StringFormat("ftruncate failed. cause: %s", strerror(errno)).str()); } #endif @@ -197,11 +197,11 @@ void AbstractDiskWriter::truncate(uint64_t length) void AbstractDiskWriter::allocate(off_t offset, uint64_t length) { if(fd == -1) { - throw DlAbortEx("File not yet opened."); + throw DL_ABORT_EX("File not yet opened."); } int r = posix_fallocate(fd, offset, length); if(r != 0) { - throw DlAbortEx(StringFormat("posix_fallocate failed. cause: %s", + throw DL_ABORT_EX(StringFormat("posix_fallocate failed. cause: %s", strerror(r)).str()); } } |
