3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef EXCEPTIONS_HEADER
21 #define EXCEPTIONS_HEADER
27 class BaseException : public std::exception
30 BaseException(const std::string &s) throw(): m_s(s) {}
31 ~BaseException() throw() {}
32 virtual const char * what() const throw()
40 class AlreadyExistsException : public BaseException {
42 AlreadyExistsException(const std::string &s): BaseException(s) {}
45 class VersionMismatchException : public BaseException {
47 VersionMismatchException(const std::string &s): BaseException(s) {}
50 class FileNotGoodException : public BaseException {
52 FileNotGoodException(const std::string &s): BaseException(s) {}
55 class DatabaseException : public BaseException {
57 DatabaseException(const std::string &s): BaseException(s) {}
60 class SerializationError : public BaseException {
62 SerializationError(const std::string &s): BaseException(s) {}
65 class PacketError : public BaseException {
67 PacketError(const std::string &s): BaseException(s) {}
70 class SettingNotFoundException : public BaseException {
72 SettingNotFoundException(const std::string &s): BaseException(s) {}
75 class InvalidFilenameException : public BaseException {
77 InvalidFilenameException(const std::string &s): BaseException(s) {}
80 class ItemNotFoundException : public BaseException {
82 ItemNotFoundException(const std::string &s): BaseException(s) {}
85 class ServerError : public BaseException {
87 ServerError(const std::string &s): BaseException(s) {}
90 class ClientStateError : public BaseException {
92 ClientStateError(const std::string &s): BaseException(s) {}
95 class PrngException : public BaseException {
97 PrngException(const std::string &s): BaseException(s) {}
100 class ModError : public BaseException {
102 ModError(const std::string &s): BaseException(s) {}
107 Some "old-style" interrupts:
110 class InvalidNoiseParamsException : public BaseException {
112 InvalidNoiseParamsException():
113 BaseException("One or more noise parameters were invalid or require "
117 InvalidNoiseParamsException(const std::string &s):
122 class InvalidPositionException : public BaseException
125 InvalidPositionException():
126 BaseException("Somebody tried to get/set something in a nonexistent position.")
128 InvalidPositionException(const std::string &s):