2010-11-29 19:13:04 +01:00
|
|
|
/*
|
2013-02-24 18:40:43 +01:00
|
|
|
Minetest
|
2013-02-24 19:38:45 +01:00
|
|
|
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2010-11-29 19:13:04 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 16:56:56 +02:00
|
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
2010-11-29 19:13:04 +01:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2012-06-05 16:56:56 +02:00
|
|
|
GNU Lesser General Public License for more details.
|
2010-11-29 19:13:04 +01:00
|
|
|
|
2012-06-05 16:56:56 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2010-11-29 19:13:04 +01:00
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2010-11-27 00:02:21 +01:00
|
|
|
#ifndef EXCEPTIONS_HEADER
|
|
|
|
#define EXCEPTIONS_HEADER
|
|
|
|
|
|
|
|
#include <exception>
|
2013-12-18 22:35:55 +01:00
|
|
|
#include <string>
|
|
|
|
|
2010-11-27 00:02:21 +01:00
|
|
|
|
|
|
|
class BaseException : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
BaseException(const std::string &s) throw()
|
2010-11-27 00:02:21 +01:00
|
|
|
{
|
|
|
|
m_s = s;
|
|
|
|
}
|
2013-12-18 22:35:55 +01:00
|
|
|
~BaseException() throw() {}
|
2010-11-27 00:02:21 +01:00
|
|
|
virtual const char * what() const throw()
|
|
|
|
{
|
2013-12-18 22:35:55 +01:00
|
|
|
return m_s.c_str();
|
2010-11-27 00:02:21 +01:00
|
|
|
}
|
2013-12-18 22:35:55 +01:00
|
|
|
protected:
|
|
|
|
std::string m_s;
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class AsyncQueuedException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
AsyncQueuedException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class NotImplementedException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
NotImplementedException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class AlreadyExistsException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
AlreadyExistsException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class VersionMismatchException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
VersionMismatchException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class FileNotGoodException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
FileNotGoodException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2016-05-17 09:59:02 +02:00
|
|
|
class DatabaseException : public BaseException {
|
|
|
|
public:
|
|
|
|
DatabaseException(const std::string &s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class SerializationError : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
SerializationError(const std::string &s): BaseException(s) {}
|
2015-04-03 08:53:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class PacketError : public BaseException {
|
|
|
|
public:
|
|
|
|
PacketError(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class LoadError : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
LoadError(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class ContainerFullException : public BaseException {
|
2010-11-27 00:02:21 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
ContainerFullException(const std::string &s): BaseException(s) {}
|
2010-11-27 00:02:21 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class SettingNotFoundException : public BaseException {
|
2010-11-29 09:52:07 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
SettingNotFoundException(const std::string &s): BaseException(s) {}
|
2010-11-29 09:52:07 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class InvalidFilenameException : public BaseException {
|
2010-11-29 09:52:07 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
InvalidFilenameException(const std::string &s): BaseException(s) {}
|
2010-11-29 09:52:07 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class ProcessingLimitException : public BaseException {
|
2010-12-11 17:11:03 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
ProcessingLimitException(const std::string &s): BaseException(s) {}
|
2010-12-11 17:11:03 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class CommandLineError : public BaseException {
|
2010-12-14 14:16:49 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
CommandLineError(const std::string &s): BaseException(s) {}
|
2010-12-14 14:16:49 +01:00
|
|
|
};
|
|
|
|
|
2013-12-18 22:35:55 +01:00
|
|
|
class ItemNotFoundException : public BaseException {
|
2010-12-20 21:03:49 +01:00
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
ItemNotFoundException(const std::string &s): BaseException(s) {}
|
2013-12-18 22:35:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class ServerError : public BaseException {
|
|
|
|
public:
|
2014-02-27 21:12:59 +01:00
|
|
|
ServerError(const std::string &s): BaseException(s) {}
|
2013-08-11 04:09:45 +02:00
|
|
|
};
|
|
|
|
|
2014-02-13 20:17:42 +01:00
|
|
|
class ClientStateError : public BaseException {
|
|
|
|
public:
|
|
|
|
ClientStateError(std::string s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
2015-04-27 07:24:37 +02:00
|
|
|
class PrngException : public BaseException {
|
|
|
|
public:
|
|
|
|
PrngException(std::string s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
2015-10-29 19:48:10 +01:00
|
|
|
class ModError : public BaseException {
|
|
|
|
public:
|
|
|
|
ModError(const std::string &s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-11-27 00:02:21 +01:00
|
|
|
/*
|
|
|
|
Some "old-style" interrupts:
|
|
|
|
*/
|
|
|
|
|
2014-11-29 22:50:18 +01:00
|
|
|
class InvalidNoiseParamsException : public BaseException {
|
|
|
|
public:
|
|
|
|
InvalidNoiseParamsException():
|
|
|
|
BaseException("One or more noise parameters were invalid or require "
|
|
|
|
"too much memory")
|
|
|
|
{}
|
|
|
|
|
|
|
|
InvalidNoiseParamsException(const std::string &s):
|
|
|
|
BaseException(s)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2010-11-27 00:02:21 +01:00
|
|
|
class InvalidPositionException : public BaseException
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
InvalidPositionException():
|
|
|
|
BaseException("Somebody tried to get/set something in a nonexistent position.")
|
|
|
|
{}
|
2014-02-27 21:12:59 +01:00
|
|
|
InvalidPositionException(const std::string &s):
|
2010-11-27 00:02:21 +01:00
|
|
|
BaseException(s)
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
class TargetInexistentException : public std::exception
|
|
|
|
{
|
|
|
|
virtual const char * what() const throw()
|
|
|
|
{
|
|
|
|
return "Somebody tried to refer to something that doesn't exist.";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class NullPointerException : public std::exception
|
|
|
|
{
|
|
|
|
virtual const char * what() const throw()
|
|
|
|
{
|
|
|
|
return "NullPointerException";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|