mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Clearer error message when regex exceeds space limit
This commit is contained in:
parent
c7346a275c
commit
17bb00d378
1 changed files with 7 additions and 2 deletions
|
@ -1734,10 +1734,15 @@ static void prim_match(EvalState & state, const Pos & pos, Value * * args, Value
|
|||
mkString(*(v.listElems()[i] = state.allocValue()), match[i + 1].str().c_str());
|
||||
}
|
||||
|
||||
} catch (std::regex_error &) {
|
||||
} catch (std::regex_error &e) {
|
||||
if (e.code() == std::regex_constants::error_space) {
|
||||
// limit is _GLIBCXX_REGEX_STATE_LIMIT for libstdc++
|
||||
throw EvalError("memory limit exceeded by regular expression ‘%s’, at %s", re, pos);
|
||||
} else {
|
||||
throw EvalError("invalid regular expression ‘%s’, at %s", re, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void prim_concatStringSep(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||
|
|
Loading…
Reference in a new issue