PorygonLang/src/Evaluator/EvaluationException.hpp

27 lines
656 B
C++
Raw Normal View History

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