summaryrefslogtreecommitdiff
path: root/src/Exception.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-05-18 15:07:15 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-05-18 15:07:15 +0000
commit20e215047c24ac5a63ff10d204003760811f2e2e (patch)
tree872156b0b66279fae1977f0d66e14bc2824281d8 /src/Exception.cc
parentff83fc65df3e4ec128c8a8855829cec7cfb6c692 (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/Exception.cc')
-rw-r--r--src/Exception.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Exception.cc b/src/Exception.cc
index 6830d79f..0dbf11fe 100644
--- a/src/Exception.cc
+++ b/src/Exception.cc
@@ -34,15 +34,19 @@
/* copyright --> */
#include "Exception.h"
+#include <sstream>
+
namespace aria2 {
-Exception::Exception(const std::string& msg):exception(), _msg(msg) {}
+Exception::Exception(const char* file, int line, const std::string& msg):
+ _file(file), _line(line), _msg(msg) {}
-Exception::Exception(const std::string& msg,
+Exception::Exception(const char* file, int line, const std::string& msg,
const Exception& cause):
- exception(), _msg(msg), _cause(cause.copy()) {}
+ _file(file), _line(line), _msg(msg), _cause(cause.copy()) {}
-Exception::Exception(const Exception& e):_msg(e._msg), _cause(e._cause)
+Exception::Exception(const char* file, int line, const Exception& e):
+ _file(file), _line(line), _msg(e._msg), _cause(e._cause)
{}
Exception::~Exception() throw() {}
@@ -54,17 +58,15 @@ const char* Exception::what() const throw()
std::string Exception::stackTrace() const throw()
{
- std::string stackTrace = "Exception: ";
- stackTrace += what();
- stackTrace += "\n";
+ std::stringstream s;
+ s << "Exception: " << "[" << _file << ":" << _line << "] " << what() << "\n";
SharedHandle<Exception> e = _cause;
while(!e.isNull()) {
- stackTrace += " -> ";
- stackTrace += e->what();
- stackTrace += "\n";
+ s << " -> " << "[" << e->_file << ":" << e->_line << "] "
+ << e->what() << "\n";
e = e->_cause;
}
- return stackTrace;
+ return s.str();
}
} // namespace aria2