Files
wc3re/exceptions.hh

60 lines
965 B
C++

#ifndef WC3RE_EXCEPTIONS_HH__
#define WC3RE_EXCEPTIONS_HH__
#include <string>
class Exception {
public:
Exception(std::string msg = "");
virtual ~Exception();
virtual std::string toString() const;
protected:
std::string msg_;
};
class FormatException : public Exception {
public:
FormatException(std::string msg);
std::string toString() const override;
};
class PathException : public Exception {
public:
PathException(std::string msg);
std::string toString() const override;
};
class POSIXException : public Exception {
public:
POSIXException(int err, std::string msg = "");
int getErr() const;
std::string toString() const override;
private:
int err_;
};
#ifdef WIN32
#define NOMINMAX
#include <Windows.h>
class Win32Exception : public Exception {
public:
Win32Exception(DWORD err, std::string msg = "");
DWORD getErr() const;
std::string toString() const override;
private:
DWORD err_;
};
#endif
#endif