1 /***************************************************************************
2 * Copyright (C) 2008 by Sverre Rabbelier *
3 * sverre@rabbelier.nl *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
25 * This file contains the custom exceptions used.
27 * @see ExcecutionException
29 * @see RowNotFoundException
36 * This exception is thrown when an exception occured as the result of a user command.
38 class ExcecutionException
: public std::runtime_error
41 /** Constructs a new ExcecutionException. */
42 ExcecutionException(std::exception
& e
, value_type accountid
, cstring line
);
44 ~ExcecutionException() throw () { }
46 const char* what() const throw() { return m_msg
.c_str(); }
49 std::exception
& m_exception
;
51 value_type m_accountid
;
56 * This exception is thrown when a savable was already locked while trying to perform an operation that needs the ock.
58 class SavableLocked
: public std::runtime_error
61 /** Construct a new SavableLocked exception. */
62 SavableLocked() : std::runtime_error("Savable was already locked.") { }
66 * This exception is thrown when no row was found as the result of an SQL query.
68 class RowNotFoundException
: public std::runtime_error
71 /** Construct a new RowNotFoundException with the specified message. */
72 RowNotFoundException(const std::string
& arg
) : std::runtime_error(arg
) { }
76 * This exception is thrown when an error occured as the result of an SQL query.
78 class SqliteError
: public std::runtime_error
81 /** Construct a new SqliteError from the specified database. */
82 SqliteError(sqlite3
*);
84 /** Construct a new SqliteError from the specified database. */
85 SqliteError(sqlite3
*, const std::string
& sql
);
87 /** Destructor, a noop. */
88 ~SqliteError() throw() { }
90 const char* what() const throw();
93 int m_sqliteErrno
; /**< The number of the error. */
94 const char* m_sqliteError
; /**< The message of the error. */
95 std::string m_msg
; /**< The compiled message. */