2010-11-29 13:13:04 -05:00
|
|
|
/*
|
2013-02-24 12:40:43 -05:00
|
|
|
Minetest
|
2013-02-24 13:38:45 -05:00
|
|
|
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
2010-11-29 13:13:04 -05:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
2012-06-05 10:56:56 -04: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 13:13:04 -05: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 10:56:56 -04:00
|
|
|
GNU Lesser General Public License for more details.
|
2010-11-29 13:13:04 -05:00
|
|
|
|
2012-06-05 10:56:56 -04:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along
|
2010-11-29 13:13:04 -05: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-26 18:02:21 -05:00
|
|
|
#ifndef EXCEPTIONS_HEADER
|
|
|
|
#define EXCEPTIONS_HEADER
|
|
|
|
|
|
|
|
#include <exception>
|
2013-12-18 16:35:55 -05:00
|
|
|
#include <string>
|
|
|
|
|
2010-11-26 18:02:21 -05:00
|
|
|
|
|
|
|
class BaseException : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
BaseException(const std::string &s) throw()
|
2010-11-26 18:02:21 -05:00
|
|
|
{
|
|
|
|
m_s = s;
|
|
|
|
}
|
2013-12-18 16:35:55 -05:00
|
|
|
~BaseException() throw() {}
|
2010-11-26 18:02:21 -05:00
|
|
|
virtual const char * what() const throw()
|
|
|
|
{
|
2013-12-18 16:35:55 -05:00
|
|
|
return m_s.c_str();
|
2010-11-26 18:02:21 -05:00
|
|
|
}
|
2013-12-18 16:35:55 -05:00
|
|
|
protected:
|
|
|
|
std::string m_s;
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class AsyncQueuedException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
AsyncQueuedException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class NotImplementedException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
NotImplementedException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class AlreadyExistsException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
AlreadyExistsException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class VersionMismatchException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
VersionMismatchException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class FileNotGoodException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
FileNotGoodException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class SerializationError : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
SerializationError(const std::string &s): BaseException(s) {}
|
2015-04-03 02:53:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class PacketError : public BaseException {
|
|
|
|
public:
|
|
|
|
PacketError(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class LoadError : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
LoadError(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class ContainerFullException : public BaseException {
|
2010-11-26 18:02:21 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
ContainerFullException(const std::string &s): BaseException(s) {}
|
2010-11-26 18:02:21 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class SettingNotFoundException : public BaseException {
|
2010-11-29 03:52:07 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
SettingNotFoundException(const std::string &s): BaseException(s) {}
|
2010-11-29 03:52:07 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class InvalidFilenameException : public BaseException {
|
2010-11-29 03:52:07 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
InvalidFilenameException(const std::string &s): BaseException(s) {}
|
2010-11-29 03:52:07 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class ProcessingLimitException : public BaseException {
|
2010-12-11 11:11:03 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
ProcessingLimitException(const std::string &s): BaseException(s) {}
|
2010-12-11 11:11:03 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class CommandLineError : public BaseException {
|
2010-12-14 08:16:49 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
CommandLineError(const std::string &s): BaseException(s) {}
|
2010-12-14 08:16:49 -05:00
|
|
|
};
|
|
|
|
|
2013-12-18 16:35:55 -05:00
|
|
|
class ItemNotFoundException : public BaseException {
|
2010-12-20 15:03:49 -05:00
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
ItemNotFoundException(const std::string &s): BaseException(s) {}
|
2013-12-18 16:35:55 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class ServerError : public BaseException {
|
|
|
|
public:
|
2014-02-27 15:12:59 -05:00
|
|
|
ServerError(const std::string &s): BaseException(s) {}
|
2013-08-10 22:09:45 -04:00
|
|
|
};
|
|
|
|
|
2014-02-13 14:17:42 -05:00
|
|
|
class ClientStateError : public BaseException {
|
|
|
|
public:
|
|
|
|
ClientStateError(std::string s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
2015-04-27 01:24:37 -04:00
|
|
|
class PrngException : public BaseException {
|
|
|
|
public:
|
|
|
|
PrngException(std::string s): BaseException(s) {}
|
|
|
|
};
|
|
|
|
|
2010-11-26 18:02:21 -05:00
|
|
|
/*
|
|
|
|
Some "old-style" interrupts:
|
|
|
|
*/
|
|
|
|
|
2014-11-29 16:50:18 -05: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-26 18:02:21 -05:00
|
|
|
class InvalidPositionException : public BaseException
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
InvalidPositionException():
|
|
|
|
BaseException("Somebody tried to get/set something in a nonexistent position.")
|
|
|
|
{}
|
2014-02-27 15:12:59 -05:00
|
|
|
InvalidPositionException(const std::string &s):
|
2010-11-26 18:02:21 -05: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
|
|
|
|
|