Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -8,21 +8,17 @@
|
||||
#include <string>
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
|
||||
class CreatureException : public ArbUt::Exception {
|
||||
public:
|
||||
explicit CreatureException(const std::string& error) : ArbUt::Exception(error) {}
|
||||
virtual ~CreatureException() = default;
|
||||
};
|
||||
|
||||
#define THROW_CREATURE(message) \
|
||||
std::stringstream ___ss; \
|
||||
___ss << "[" << __FILENAME__ << ":" << __LINE__ << "] " << message; \
|
||||
throw CreatureException(___ss.str());
|
||||
throw ArbUt::Exception(___ss.str());
|
||||
#define NOT_REACHABLE THROW_CREATURE("Not reachable");
|
||||
#define NOT_IMPLEMENTED THROW_CREATURE("Not implemented");
|
||||
|
||||
#define try_creature(data, msg) \
|
||||
try { \
|
||||
data; \
|
||||
} catch (const CreatureException& e) { \
|
||||
} catch (const ArbUt::Exception& e) { \
|
||||
throw e; \
|
||||
} catch (const std::exception& e) { \
|
||||
THROW_CREATURE(msg << ": '" << e.what() << "'."); \
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef CREATURELIB_NOTIMPLEMENTEDEXCEPTION_HPP
|
||||
#define CREATURELIB_NOTIMPLEMENTEDEXCEPTION_HPP
|
||||
|
||||
#include "CreatureException.hpp"
|
||||
|
||||
class NotImplementedException : CreatureException {
|
||||
public:
|
||||
NotImplementedException(std::string error) : CreatureException(error) {}
|
||||
NotImplementedException() : CreatureException("Not Implemented") {}
|
||||
};
|
||||
|
||||
#endif // CREATURELIB_NOTIMPLEMENTEDEXCEPTION_HPP
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef CREATURELIB_NOTREACHABLEEXCEPTION_HPP
|
||||
#define CREATURELIB_NOTREACHABLEEXCEPTION_HPP
|
||||
|
||||
#include "CreatureException.hpp"
|
||||
|
||||
class NotReachableException : CreatureException {
|
||||
public:
|
||||
NotReachableException() : CreatureException("Not Reachable"){};
|
||||
};
|
||||
|
||||
#endif // CREATURELIB_NOTREACHABLEEXCEPTION_HPP
|
||||
Reference in New Issue
Block a user