include/wrenbind17/exception.hpp
#
Namespaces
#
Classes
#
Source code
#
#pragma once
#include <stdexcept>
#include <memory>
#include <string>
namespace wrenbind17 {
class Exception : public std::exception {
public:
Exception() = default;
explicit Exception(std::string msg) : msg(std::move(msg)) {
}
const char* what() const throw() override {
return msg.c_str();
}
private:
std::string msg;
};
class NotFound : public Exception {
public:
NotFound() : Exception("Not found") {
}
};
class BadCast : public Exception {
public:
BadCast() : Exception("Bad cast") {
}
explicit BadCast(std::string msg) : Exception(std::move(msg)) {
}
};
class RuntimeError : public Exception {
public:
explicit RuntimeError(std::string msg) : Exception(std::move(msg)) {
}
};
class CompileError : public Exception {
public:
explicit CompileError(std::string msg) : Exception(std::move(msg)) {
}
};
} // namespace wrenbind17
Updated on 17 October 2023 at 12:26:25 UTC