better exception message in some cases
This commit is contained in:
parent
c8c25e9952
commit
a5a0029341
7
ml.cpp
7
ml.cpp
|
|
@ -636,6 +636,10 @@ std::string MlError::description() const {
|
|||
return MlPerfMon::instance().callstack() + "error: the expression `" + cause->debug() + "` with message \"" + msg + "\"";
|
||||
}
|
||||
|
||||
const char * MlError::what() const noexcept {
|
||||
return msg;
|
||||
}
|
||||
|
||||
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.
|
||||
|
|
@ -1844,8 +1848,7 @@ MlValue sprintf(std::vector<MlValue> args, MlEnvironment &env) {
|
|||
if (args.size() < 1 || args.size() > 2)
|
||||
throw MlError(MlValue("sprintf", sprintf), env, args.size() > 2 ? TOO_MANY_ARGS : TOO_FEW_ARGS);
|
||||
|
||||
return MlValue::string(
|
||||
mini_sprintf(args[0].as_string(), args.size() == 2 ? args[1].as_list() : std::vector<MlValue>{}));
|
||||
return MlValue::string(mini_sprintf(args[0].as_string(), args.size() == 2 ? args[1].as_list() : std::vector<MlValue>{}));
|
||||
}
|
||||
|
||||
// >>> (map (lambda (x) (+ x 10)) '(1 2 3 4 5 6))
|
||||
|
|
|
|||
Loading…
Reference in New Issue