From 177c4e82c25a7d6659dbfdfff39a2a96b76fa4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <rafael.carre@savoirfairelinux.com> Date: Thu, 28 Jul 2011 15:41:45 -0400 Subject: [PATCH] * #6547: CallManagerException: use runtime exceptions Replace debus+throw by throw --- sflphone-common/src/dbus/callmanager.cpp | 12 ++++-------- sflphone-common/src/dbus/callmanager.h | 10 +++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index aaafcf6f29..1cf00a123e 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -361,23 +361,20 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink (AccountNULL)); if (!link) { - _debug ("CallManager: Failed to get sip link"); - throw CallManagerException(); + throw CallManagerException("Failed to get sip link"); } SIPCall *call = link->getSIPCall (callID); if (!call) { - _debug ("CallManager: Call id %d is not valid", callID.c_str()); - throw CallManagerException(); + throw CallManagerException("Call id " + callID + " is not valid"); } sfl::AudioRtpFactory * audioRtp = NULL; audioRtp = call->getAudioRtp(); if (!audioRtp) { - _debug ("CallManager: Failed to get AudioRtpFactory"); - throw CallManagerException(); + throw CallManagerException("Failed to get AudioRtpFactory"); } sfl::AudioZrtpSession * zSession = NULL; @@ -385,8 +382,7 @@ sfl::AudioZrtpSession * CallManager::getAudioZrtpSession (const std::string& cal zSession = audioRtp->getAudioZrtpSession(); if (!zSession) { - _debug ("CallManager: Failed to get AudioZrtpSession"); - throw CallManagerException(); + throw CallManagerException("Failed to get AudioZrtpSession"); } return zSession; diff --git a/sflphone-common/src/dbus/callmanager.h b/sflphone-common/src/dbus/callmanager.h index daca254d9e..9c65a58023 100644 --- a/sflphone-common/src/dbus/callmanager.h +++ b/sflphone-common/src/dbus/callmanager.h @@ -43,13 +43,13 @@ #pragma GCC diagnostic warning "-Wunused-parameter" #include <dbus-c++/dbus.h> -#include <exception> +#include <stdexcept> -class CallManagerException: public std::exception +class CallManagerException: public std::runtime_error { - virtual const char* what() const throw() { - return "A CallManagerException occured"; - } + public: + CallManagerException(const std::string& str="") : + std::runtime_error("A CallManagerException occured: " + str) {} }; namespace sfl -- GitLab