Archived
util: one wording for the bounded read's refusal
The refuse sites that read a container file all re-typed the same two-branch message -- over ? "carries far too many values" : "nests far too deep" -- six times, and the copies had already drifted: gen_config said "carries far too many JSON values", xstats "far too many values", tokenizer_config "it does not parse" for the discarded case. The bounds themselves (2^24, 256) were also spelled as literals in tokenizer_json's refusal, so a bound change there would make its message a lie. Json::bound_why(over, deep) is the phrase, owned beside the read that sets the flags, and the two bounds are exported as kContainerBudget / kContainerDepth so the one message that states them reads them from the constants. Every refuse site now calls it; the wording is one, the numbers cannot drift. No behaviour change -- the same flags map to the same failure paths, only the text they print is unified.
This commit is contained in:
1 parent
5e2e596644
commit
b9ecbde0d6
6 files changed
+23
-14
No files matched your search
@@ -541,7 +541,7 @@ int xs_profile_load(const std::string& path, std::vector<RadFileProfile>* out, i
|
||||
Json j = Json::parse_container(text, &over, &deep);
|
||||
if (over || deep || j.is_discarded()) {
|
||||
RAD_ERR("--expert-profile: %s is not JSON (%s)", path.c_str(),
|
||||
over ? "far too many values" : deep ? "nests far too deep" : "malformed");
|
||||
Json::bound_why(over, deep));
|
||||
return RAD_E_INVAL;
|
||||
}
|
||||
if (!j.is_object() || j.value("format", "") != "radiance-expert-stats/1" ||
|
||||
|
||||
Reference in new issue
Block a user