From 89351e448459c5c0bf429f529860cd64d4d5e609 Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Fri, 18 Dec 2020 16:42:00 -0800 Subject: [PATCH] AuthenticationException: derives from std::exception (#1222) Closes #1178 --- .../azure-core/inc/azure/core/credentials.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sdk/core/azure-core/inc/azure/core/credentials.hpp b/sdk/core/azure-core/inc/azure/core/credentials.hpp index aafa47fae..928b70281 100644 --- a/sdk/core/azure-core/inc/azure/core/credentials.hpp +++ b/sdk/core/azure-core/inc/azure/core/credentials.hpp @@ -11,9 +11,9 @@ #include "azure/core/context.hpp" #include +#include #include #include -#include #include #include #include @@ -64,13 +64,22 @@ namespace Azure { namespace Core { /** * @brief An exception that gets thrown when authentication error occurs. */ - class AuthenticationException : public std::runtime_error { + class AuthenticationException : public std::exception { + std::string m_message; + public: /** * @brief Construct with message string. * - * @param msg Message string. + * @param message Message string. */ - explicit AuthenticationException(std::string const& msg) : std::runtime_error(msg) {} + explicit AuthenticationException(std::string message) : m_message(std::move(message)) {} + + /** + * Get the explanatory string. + * + * @return C string with explanatory information. + */ + char const* what() const noexcept override { return m_message.c_str(); } }; }} // namespace Azure::Core