diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-06-23 13:17:56 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-06-24 13:35:25 +0200 |
commit | bb18938b809637a37df53aabc28937f1bf7b00c7 (patch) | |
tree | 2504722189825c7036da07611aff65f1b7dc2b12 /src/buildtool/common/action_description.hpp | |
parent | c322048c9b5469cd09bf51a99f6eea26e4beedfa (diff) | |
download | justbuild-bb18938b809637a37df53aabc28937f1bf7b00c7.tar.gz |
action deserialisation: accept null for "may_fail"
In that way, we are consistent with all other values in that there
is a way to positively state that the default value should be taken.
While there, fix a wrong error message.
Diffstat (limited to 'src/buildtool/common/action_description.hpp')
-rw-r--r-- | src/buildtool/common/action_description.hpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/buildtool/common/action_description.hpp b/src/buildtool/common/action_description.hpp index f830eb82..845ea5a5 100644 --- a/src/buildtool/common/action_description.hpp +++ b/src/buildtool/common/action_description.hpp @@ -98,12 +98,17 @@ class ActionDescription { bool no_cache{}; auto may_fail_it = desc.find("may_fail"); if (may_fail_it != desc.end()) { - if (not may_fail_it->is_string()) { + if (may_fail_it->is_null()) { + may_fail = std::nullopt; + } + else if (may_fail_it->is_string()) { + may_fail = *may_fail_it; + } + else { Logger::Log(LogLevel::Error, - "may_fail has to be a boolean"); + "may_fail has to be a null or a string"); return std::nullopt; } - may_fail = *may_fail_it; } auto no_cache_it = desc.find("no_cache"); if (no_cache_it != desc.end()) { |