mirror of
https://github.com/MaskRay/ccls.git
synced 2025-02-16 21:58:08 +00:00
Better error reporting in ResponseMessage
This commit is contained in:
parent
90c2a54bbc
commit
8f41aa72de
@ -162,8 +162,8 @@ optional<std::string> MessageRegistry::Parse(
|
||||
} catch (std::invalid_argument& e) {
|
||||
// *message is partially deserialized but some field (e.g. |id|) are likely
|
||||
// available.
|
||||
return std::string("Unable to deserialize request '") + method + "' " +
|
||||
static_cast<JsonReader&>(visitor).GetPath() + " " + e.what();
|
||||
return std::string("Fail to parse '") + method + "' " +
|
||||
static_cast<JsonReader&>(visitor).GetPath() + ", expected " + e.what();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,10 @@ class JsonReader : public Reader {
|
||||
// Use "0" to indicate any element for now.
|
||||
path_.push_back("0");
|
||||
for (auto& entry : m_->GetArray()) {
|
||||
JsonReader sub(&entry);
|
||||
fn(sub);
|
||||
auto saved = m_;
|
||||
m_ = &entry;
|
||||
fn(*this);
|
||||
m_ = saved;
|
||||
}
|
||||
path_.pop_back();
|
||||
}
|
||||
@ -53,8 +55,10 @@ class JsonReader : public Reader {
|
||||
path_.push_back(name);
|
||||
auto it = m_->FindMember(name);
|
||||
if (it != m_->MemberEnd()) {
|
||||
JsonReader sub(&it->value);
|
||||
fn(sub);
|
||||
auto saved = m_;
|
||||
m_ = &it->value;
|
||||
fn(*this);
|
||||
m_ = saved;
|
||||
}
|
||||
path_.pop_back();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user