From ad4720d0222778abbe971e8be049e9ba37d90159 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Thu, 9 May 2019 17:56:21 +0200 Subject: [PATCH] nicer errors --- src/pEpmodule.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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)