From bbd1eb8fb1c66e6af330595101dda554dd3a0da7 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:22:02 -0400 Subject: [PATCH] * #6547: InstantMessageException: use runtime exceptions Avoid using stack variables out of their scope --- sflphone-common/src/im/InstantMessaging.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sflphone-common/src/im/InstantMessaging.h b/sflphone-common/src/im/InstantMessaging.h index c88acc2473..d8369f6a70 100644 --- a/sflphone-common/src/im/InstantMessaging.h +++ b/sflphone-common/src/im/InstantMessaging.h @@ -45,7 +45,7 @@ #include <map> #include <list> -#include <exception> +#include <stdexcept> #include <iax-client.h> @@ -65,21 +65,11 @@ namespace sfl const std::string IM_XML_URI ("uri"); const std::string BOUNDARY ("--boundary"); -class InstantMessageException : public std::exception +class InstantMessageException : public std::runtime_error { public: - InstantMessageException (const std::string& str="") throw() : errstr (str) {} - - virtual ~InstantMessageException() throw() {} - - virtual const char *what() const throw() { - std::string expt ("InstantMessageException occured: "); - expt.append (errstr); - - return expt.c_str(); - } - private: - std::string errstr; + InstantMessageException (const std::string& str="") : + std::runtime_error("InstantMessageException occured: " + str) {} }; class InstantMessaging -- GitLab