Files
CPP/common/except.hpp
2025-08-10 11:35:20 -04:00

51 lines
1.1 KiB
C++
Executable File

#ifndef _COMMON_EXCEPTION_HPP_
#define _COMMON_EXCEPTION_HPP_
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class Exception
{
public:
Exception(){mReason="";}
Exception(const String &reason){mReason=reason;}
virtual ~Exception(){;}
virtual String toString(){return mReason;}
const String &getReason(void)const{return mReason;};
private:
String mReason;
};
class BoundaryError : public Exception
{
public :
String toString(){return "BoundaryError";}
};
class NullError : public Exception
{
public :
String toString(){return "NullError";}
};
class ArrayIndexOutOfBoundsException : public Exception
{
public :
String toString(){return "ArrayIndexOutOfBounds";}
};
class LibraryNotFoundException : public Exception
{
public:
LibraryNotFoundException(const String &reason="LibraryNotFoundException"):Exception(reason){;}
String toString(){return getReason();}
};
class InvalidStateException : public Exception
{
public:
InvalidStateException(const String &reason="InvalidStateException"):Exception(reason){;}
String toString(){return getReason();}
};
#endif