Use ndn_getErrorString when throwing the exception
diff --git a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
index eac9a8d..ad562ff 100644
--- a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
+++ b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
@@ -31,9 +31,9 @@
*/
bool findElementEnd(unsigned char *input, unsigned int inputLength)
{
- char *error;
+ ndn_Error error;
if (error = ndn_BinaryXMLStructureDecoder_findElementEnd(&base_, input, inputLength))
- throw std::runtime_error(error);
+ throw std::runtime_error(ndn_getErrorString(error));
return gotElementEnd();
}
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index 714dd1d..3454545 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -39,9 +39,9 @@
struct ndn_BinaryXMLDecoder decoder;
ndn_BinaryXMLDecoder_init(&decoder, (unsigned char *)input, inputLength);
- char *error;
+ ndn_Error error;
if (error = ndn_decodeBinaryXMLName(&nameStruct, &decoder))
- throw std::runtime_error(error);
+ throw std::runtime_error(ndn_getErrorString(error));
name.set(nameStruct);
}
@@ -55,9 +55,9 @@
struct ndn_BinaryXMLDecoder decoder;
ndn_BinaryXMLDecoder_init(&decoder, (unsigned char *)input, inputLength);
- char *error;
+ ndn_Error error;
if (error = ndn_decodeBinaryXMLInterest(&interestStruct, &decoder))
- throw std::runtime_error(error);
+ throw std::runtime_error(ndn_getErrorString(error));
interest.set(interestStruct);
}