diff --git a/ml.cpp b/ml.cpp index 098c5e9..a962859 100644 --- a/ml.cpp +++ b/ml.cpp @@ -633,10 +633,6 @@ std::string MlError::description() const { "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) { // Normally, I would use the `insert` method of the `map` class, // but it doesn't overwrite previously declared values for keys. @@ -2130,7 +2126,7 @@ int main(int argc, char *argv[]) { return 0; } catch (MlError &e) { - std::cerr << e.what() << std::endl; + std::cerr << e.description() << std::endl; } catch (const std::exception &e) { std::cerr << MlPerfMon::instance().callstack() << e.what() << std::endl; MlPerfMon::instance().clear_callstack(); diff --git a/ml.h b/ml.h index 056276c..8d81575 100644 --- a/ml.h +++ b/ml.h @@ -83,9 +83,6 @@ public: // Get the printable error description. std::string description() const; - // inherited from std::exception - virtual const char* what() const noexcept; - private: MlValue *cause; MlEnvironment env;