MlError does not override what()

This commit is contained in:
VaclavT 2021-05-22 07:56:28 +02:00
parent cd8838c37d
commit 858db14e6d
2 changed files with 1 additions and 8 deletions

6
ml.cpp
View File

@ -633,10 +633,6 @@ std::string MlError::description() const {
"error: the expression `" + cause->debug() + "` with message \"" + msg + "\""; "error: the expression `" + cause->debug() + "` with message \"" + msg + "\"";
} }
const char* MlError::what() const noexcept {
return ("error: the expression `" + cause->debug() + "` with message \"" + msg + "\"").c_str();
}
void MlEnvironment::combine(MlEnvironment const &other) { void MlEnvironment::combine(MlEnvironment const &other) {
// Normally, I would use the `insert` method of the `map` class, // Normally, I would use the `insert` method of the `map` class,
// but it doesn't overwrite previously declared values for keys. // but it doesn't overwrite previously declared values for keys.
@ -2130,7 +2126,7 @@ int main(int argc, char *argv[]) {
return 0; return 0;
} catch (MlError &e) { } catch (MlError &e) {
std::cerr << e.what() << std::endl; std::cerr << e.description() << std::endl;
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cerr << MlPerfMon::instance().callstack() << e.what() << std::endl; std::cerr << MlPerfMon::instance().callstack() << e.what() << std::endl;
MlPerfMon::instance().clear_callstack(); MlPerfMon::instance().clear_callstack();

3
ml.h
View File

@ -83,9 +83,6 @@ public:
// Get the printable error description. // Get the printable error description.
std::string description() const; std::string description() const;
// inherited from std::exception
virtual const char* what() const noexcept;
private: private:
MlValue *cause; MlValue *cause;
MlEnvironment env; MlEnvironment env;