diff --git a/server/mt-server.cc b/server/mt-server.cc index ab57780..4bf7041 100644 --- a/server/mt-server.cc +++ b/server/mt-server.cc @@ -42,10 +42,31 @@ In::~In() // no automatic release! } + +// in pEpEngine.h positive values are hex, negative are decimal. :-o +std::string status_to_string(PEP_STATUS status) +{ + if(status==PEP_STATUS_OK) + return "PEP_STATUS_OK"; + + std::stringstream ss; + if(status>0) + { + ss << "0x" << std::hex << status; + }else{ + ss << status; + } + return ss.str(); +} + PEP_SESSION createSession() { PEP_SESSION session = nullptr; - init(&session); + auto ret = init(&session); + if(ret != PEP_STATUS_OK) + { + throw std::runtime_error("createSession() failed because pEp's init() returns " + status_to_string(ret) ); + } return session; } diff --git a/server/registry.hh b/server/registry.hh index 1dae8a9..f8f594d 100644 --- a/server/registry.hh +++ b/server/registry.hh @@ -76,7 +76,7 @@ public: if(ret.second == false) { d(rsrc); - throw std::runtime_error("Duplicate entry"); + throw std::runtime_error("Duplicate entry: id=" + std::to_string(id) + ", rsrc=" + std::to_string( intptr_t(rsrc) ) ); } return id; }