diff --git a/src/pEpmodule.cc b/src/pEpmodule.cc index f9b6d3c..c506353 100644 --- a/src/pEpmodule.cc +++ b/src/pEpmodule.cc @@ -16,6 +16,7 @@ #include #include #include +#include namespace pEp { namespace PythonAdapter { @@ -75,9 +76,14 @@ namespace pEp { if (status == PEP_ILLEGAL_VALUE) throw invalid_argument("illegal value"); - stringstream build; - build << setfill('0') << "p≡p 0x" << setw(4) << hex << status; - throw runtime_error(build.str()); + if (string(pEp_status_to_string(status)) == "unknown status code") { + stringstream build; + build << setfill('0') << "p≡p 0x" << setw(4) << hex << status; + throw runtime_error(build.str()); + } + else { + throw runtime_error(pEp_status_to_string(status)); + } } PEP_STATUS _messageToSend(::message *msg)