summaryrefslogtreecommitdiff
path: root/src/NameResolver.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-04-27 02:22:14 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-04-27 02:22:14 +0000
commit1ef99931e131343f069a4b74edfc06196d72d85b (patch)
treed640f061a66a193d5f4d92b61836161208ccff14 /src/NameResolver.cc
parenta7952cce05a41c6e20d6eddc569a8bffe974aade (diff)
2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten Exception class. Throw exception object, not its pointer and catch by reference, so that remove problematic delete operator for catched exception. * src/Exception.cc * src/Exception.h * test/ExceptionTest.cc * src/*: All files throwing/catching exception. * test/*: All files throwing/catching exception.
Diffstat (limited to 'src/NameResolver.cc')
-rw-r--r--src/NameResolver.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/NameResolver.cc b/src/NameResolver.cc
index df77cd0e..3b6ecada 100644
--- a/src/NameResolver.cc
+++ b/src/NameResolver.cc
@@ -35,6 +35,7 @@
#include "NameResolver.h"
#include "DlAbortEx.h"
#include "message.h"
+#include "StringFormat.h"
#include <cstring>
namespace aria2 {
@@ -108,8 +109,8 @@ void NameResolver::resolve(const std::string& hostname)
struct addrinfo* res;
int ec;
if((ec = getaddrinfo(hostname.c_str(), 0, &ai, &res)) != 0) {
- throw new DlAbortEx(EX_RESOLVE_HOSTNAME,
- hostname.c_str(), gai_strerror(ec));
+ throw DlAbortEx(StringFormat(EX_RESOLVE_HOSTNAME,
+ hostname.c_str(), gai_strerror(ec)).str());
}
_addr = ((struct sockaddr_in*)res->ai_addr)->sin_addr;
freeaddrinfo(res);