SQLiteC++  0.5.0
SQLiteC++ is a smart and easy to use C++ SQLite3 wrapper.
 All Classes Namespaces Files Functions Friends Macros
Exception.h
Go to the documentation of this file.
1 /**
2  * @file Exception.h
3  * @brief Encapsulation of the error message from SQLite3 on a std::runtime_error.
4  *
5  * Copyright (c) 2012-2013 Sebastien Rombauts (sebastien.rombauts@gmail.com)
6  *
7  * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
8  * or copy at http://opensource.org/licenses/MIT)
9  */
10 #pragma once
11 
12 #include <stdexcept>
13 #include <cassert>
14 
15 
16 // assert() is used in destructors, where exceptions are not allowed
17 // here you can chose if you whant to use them or not
18 #ifdef _DEBUG
19  // in debug mode :
20  #define SQLITE_CPP_ASSERT(expression) assert(expression)
21 #else
22  // in release mode :
23  #define SQLITE_CPP_ASSERT(expression) (expression)
24 #endif
25 
26 
27 #ifdef _WIN32
28 #pragma warning(disable:4290) // Disable warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
29 #endif
30 
31 namespace SQLite
32 {
33 
34 /**
35  * @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
36  */
37 class Exception : public std::runtime_error
38 {
39 public:
40  /**
41  * @brief Encapsulation of the error message from SQLite3, based on std::runtime_error.
42  *
43  * @param[in] aErrorMessage The string message describing the SQLite error
44  */
45  Exception(const std::string& aErrorMessage) :
46  std::runtime_error(aErrorMessage)
47  {
48  }
49 };
50 
51 
52 } // namespace SQLite