PorygonLang/src/Evaluator/EvaluationException.hpp

27 lines
656 B
C++

#ifndef PORYGONLANG_EVALUATIONEXCEPTION_HPP
#define PORYGONLANG_EVALUATIONEXCEPTION_HPP
#include <utility>
#include <exception>
#include <string>
using namespace std;
namespace Porygon::Evaluation {
class EvaluationException : public std::exception {
string _message;
public:
explicit EvaluationException(const string& message) {
_message = defaultErrorText +message;
}
const string defaultErrorText = "An evaluation exception occurred: ";
inline const char *what() const noexcept final {
return _message.c_str();
}
};
}
#endif //PORYGONLANG_EVALUATIONEXCEPTION_HPP