36 bool allow_non_string_keys,
42 return allow_non_string_keys ? (*d)[key] : (*d)[key.
asString()];
45 throw DynamicParserLogicError(
46 "Unsupported key type ",
55 const std::exception& ex) {
64 if (
auto* e_val_ptr = e.get_ptr(
"value")) {
67 if (*e_val_ptr !=
value()) {
69 "Overwriting value: ",
84 if (lookup_k ==
nullptr) {
88 auto& key_errors = e[
"key_errors"];
89 if (key_errors.isNull()) {
95 if (!e_msg.isNull()) {
97 "Overwriting error: ",
110 LOG(
FATAL) <<
"Bad onError_: " <<
static_cast<int>(
onError_);
115 stackPtr_->key_ = key_;
116 stackPtr_->value_ = value_;
117 if (stackPtr_->unmaterializedSubErrorKeys_.empty()) {
119 CHECK_GE(stackPtr_->subErrors_.size(), 2u)
120 <<
"Internal bug: out of suberrors";
121 stackPtr_->subErrors_.pop_back();
125 stackPtr_->unmaterializedSubErrorKeys_.pop_back();
126 CHECK(!stackPtr_->subErrors_.empty()) <<
"Internal bug: out of suberrors";
138 unmaterializedSubErrorKeys_.emplace_back(key_);
145 bool allow_non_string_keys)
noexcept {
147 CHECK(!subErrors_.empty()) <<
"Internal bug: out of suberrors";
148 for (
const auto& suberror_key : unmaterializedSubErrorKeys_) {
149 auto& nested = (*subErrors_.back())[
"nested"];
150 if (nested.isNull()) {
155 insertAtKey(&nested, allow_non_string_keys, *suberror_key);
156 if (my_errors.isNull()) {
159 subErrors_.emplace_back(&my_errors);
161 unmaterializedSubErrorKeys_.clear();
162 return *subErrors_.back();
166 if (key_ || unmaterializedSubErrorKeys_.size() != 0 ||
167 subErrors_.size() != 1) {
169 "Do not releaseErrors() while parsing: ",
172 unmaterializedSubErrorKeys_.size(),
176 return releaseErrorsImpl();
184 if (errors_.isNull()) {
195 std::stringstream ss;
bool allowNonStringKeyErrors_
static ObjectMaker object()
const char * typeName() const
folly::dynamic releaseErrors()
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
requires E e noexcept(noexcept(s.error(std::move(e))))
const folly::dynamic & value() const
std::string asString() const
std::string toPseudoJson(const folly::dynamic &d)
GuardImpl guard(ErrorHandler &&handler)
folly::dynamic & errors(bool allow_non_string_keys) noexcept
void operator()() noexcept
folly::dynamic releaseErrorsImpl()
PopGuard push(const folly::dynamic &k, const folly::dynamic &v) noexcept
void reportError(const folly::dynamic *lookup_k, const std::exception &ex)