mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Add SQLite::Exception constructor that takes const char* in order to avoid possible std::bad_alloc exception
std::runtime_error provides such overload in c++11, therefore it will make no difference when compiling for c++03, but should provide no harm either
This commit is contained in:
parent
94ebe5ced6
commit
67ac88fb1e
@ -50,6 +50,7 @@ public:
|
||||
*
|
||||
* @param[in] aErrorMessage The string message describing the SQLite error
|
||||
*/
|
||||
explicit Exception(const char* aErrorMessage);
|
||||
explicit Exception(const std::string& aErrorMessage);
|
||||
|
||||
/**
|
||||
@ -58,6 +59,7 @@ public:
|
||||
* @param[in] aErrorMessage The string message describing the SQLite error
|
||||
* @param[in] ret Return value from function call that failed.
|
||||
*/
|
||||
Exception(const char* aErrorMessage, int ret);
|
||||
Exception(const std::string& aErrorMessage, int ret);
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,12 @@
|
||||
namespace SQLite
|
||||
{
|
||||
|
||||
Exception::Exception(const char* aErrorMessage) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(-1), // 0 would be SQLITE_OK, which doesn't make sense
|
||||
mExtendedErrcode(-1)
|
||||
{
|
||||
}
|
||||
Exception::Exception(const std::string& aErrorMessage) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(-1), // 0 would be SQLITE_OK, which doesn't make sense
|
||||
@ -23,6 +29,13 @@ Exception::Exception(const std::string& aErrorMessage) :
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception(const char* aErrorMessage, int ret) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(ret),
|
||||
mExtendedErrcode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
Exception::Exception(const std::string& aErrorMessage, int ret) :
|
||||
std::runtime_error(aErrorMessage),
|
||||
mErrcode(ret),
|
||||
|
Loading…
x
Reference in New Issue
Block a user