/** * @file Exception.h * @ingroup SQLiteCpp * @brief Encapsulation of the error message from SQLite3 on a std::runtime_error. * * Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com) * * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt * or copy at http://opensource.org/licenses/MIT) */ #pragma once #include #include namespace SQLite { /** * @brief Encapsulation of the error message from SQLite3, based on std::runtime_error. */ class Exception : public std::runtime_error { public: /** * @brief Encapsulation of the error message from SQLite3, based on std::runtime_error. * * @param[in] aErrorMessage The string message describing the SQLite error */ explicit Exception(const std::string& aErrorMessage) : std::runtime_error(aErrorMessage) { } }; } // namespace SQLite /// Compatibility with non-clang compilers. #ifndef __has_feature #define __has_feature(x) 0 #endif // Detect whether the compiler supports C++11 noexcept exception specifications. #if (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 7 ) && defined(__GXX_EXPERIMENTAL_CXX0X__)) // GCC 4.7 and following have noexcept #elif defined(__clang__) && __has_feature(cxx_noexcept) // Clang 3.0 and above have noexcept #else #define noexcept throw() #endif