Skip to content
Snippets Groups Projects
Commit 46dd56f2 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

* #6547: AudioZrtp: use runtime exceptions

Also support custom exception strings
parent dbe4aff6
No related branches found
No related tags found
No related merge requests found
...@@ -101,7 +101,7 @@ void AudioZrtpSession::initializeZid (void) ...@@ -101,7 +101,7 @@ void AudioZrtpSession::initializeZid (void)
{ {
if (_zidFilename.empty()) { if (_zidFilename.empty()) {
throw ZrtpZidException(); throw ZrtpZidException("zid filename empty");
} }
std::string zidCompleteFilename; std::string zidCompleteFilename;
...@@ -131,12 +131,12 @@ void AudioZrtpSession::initializeZid (void) ...@@ -131,12 +131,12 @@ void AudioZrtpSession::initializeZid (void)
if (remove (zidCompleteFilename.c_str()) !=0) { if (remove (zidCompleteFilename.c_str()) !=0) {
_debug ("Failed to remove zid file because of: %s", strerror (errno)); _debug ("Failed to remove zid file because of: %s", strerror (errno));
throw ZrtpZidException(); throw ZrtpZidException("zid file deletion failed");
} }
if (initialize (zidCompleteFilename.c_str()) < 0) { if (initialize (zidCompleteFilename.c_str()) < 0) {
_debug ("ZRTP initialization failed"); _debug ("ZRTP initialization failed");
throw ZrtpZidException(); throw ZrtpZidException("zid initialization failed");
} }
return; return;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define __SFL_AUDIO_ZRTP_SESSION_H__ #define __SFL_AUDIO_ZRTP_SESSION_H__
#include <cstddef> #include <cstddef>
#include <stdexcept>
using std::ptrdiff_t; using std::ptrdiff_t;
#include <ccrtp/rtp.h> #include <ccrtp/rtp.h>
...@@ -46,11 +47,11 @@ class SIPCall; ...@@ -46,11 +47,11 @@ class SIPCall;
namespace sfl namespace sfl
{ {
class ZrtpZidException: public std::exception class ZrtpZidException: public std::runtime_error
{ {
virtual const char* what() const throw() { public:
return "ZRTP ZID initialization failed."; ZrtpZidException (const std::string& str="") :
} std::runtime_error("ZRTP ZID initialization failed." + str) {}
}; };
// class AudioZrtpSession : public ost::TimerPort, public ost::SymmetricZRTPSession, public AudioRtpRecordHandler // class AudioZrtpSession : public ost::TimerPort, public ost::SymmetricZRTPSession, public AudioRtpRecordHandler
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment