summaryrefslogtreecommitdiff
path: root/src/BtExtendedMessage.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/BtExtendedMessage.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/BtExtendedMessage.cc')
-rw-r--r--src/BtExtendedMessage.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/BtExtendedMessage.cc b/src/BtExtendedMessage.cc
index 361503e6..b576bd4d 100644
--- a/src/BtExtendedMessage.cc
+++ b/src/BtExtendedMessage.cc
@@ -48,6 +48,7 @@
#include "DlAbortEx.h"
#include "message.h"
#include "Util.h"
+#include "StringFormat.h"
#include <cassert>
#include <cstring>
@@ -100,11 +101,13 @@ BtExtendedMessage::create(const BtContextHandle& btContext,
const unsigned char* data, size_t dataLength)
{
if(dataLength < 2) {
- throw new DlAbortEx(MSG_TOO_SMALL_PAYLOAD_SIZE, "extended", dataLength);
+ throw DlAbortEx
+ (StringFormat(MSG_TOO_SMALL_PAYLOAD_SIZE, "extended", dataLength).str());
}
uint8_t id = PeerMessageUtil::getId(data);
if(id != ID) {
- throw new DlAbortEx(EX_INVALID_BT_MESSAGE_ID, id, "extended", ID);
+ throw DlAbortEx
+ (StringFormat(EX_INVALID_BT_MESSAGE_ID, id, "extended", ID).str());
}
ExtensionMessageFactoryHandle factory = EXTENSION_MESSAGE_FACTORY(btContext,
peer);