mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-10-31 20:53:01 +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) { |   } catch (std::invalid_argument& e) { | ||||||
|     // *message is partially deserialized but some field (e.g. |id|) are likely
 |     // *message is partially deserialized but some field (e.g. |id|) are likely
 | ||||||
|     // available.
 |     // available.
 | ||||||
|     return std::string("Unable to deserialize request '") + method + "' " + |     return std::string("Fail to parse '") + method + "' " + | ||||||
|            static_cast<JsonReader&>(visitor).GetPath() + " " + e.what(); |            static_cast<JsonReader&>(visitor).GetPath() + ", expected " + e.what(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -43,8 +43,10 @@ class JsonReader : public Reader { | |||||||
|     // Use "0" to indicate any element for now.
 |     // Use "0" to indicate any element for now.
 | ||||||
|     path_.push_back("0"); |     path_.push_back("0"); | ||||||
|     for (auto& entry : m_->GetArray()) { |     for (auto& entry : m_->GetArray()) { | ||||||
|       JsonReader sub(&entry); |       auto saved = m_; | ||||||
|       fn(sub); |       m_ = &entry; | ||||||
|  |       fn(*this); | ||||||
|  |       m_ = saved; | ||||||
|     } |     } | ||||||
|     path_.pop_back(); |     path_.pop_back(); | ||||||
|   } |   } | ||||||
| @ -53,8 +55,10 @@ class JsonReader : public Reader { | |||||||
|     path_.push_back(name); |     path_.push_back(name); | ||||||
|     auto it = m_->FindMember(name); |     auto it = m_->FindMember(name); | ||||||
|     if (it != m_->MemberEnd()) { |     if (it != m_->MemberEnd()) { | ||||||
|       JsonReader sub(&it->value); |       auto saved = m_; | ||||||
|       fn(sub); |       m_ = &it->value; | ||||||
|  |       fn(*this); | ||||||
|  |       m_ = saved; | ||||||
|     } |     } | ||||||
|     path_.pop_back(); |     path_.pop_back(); | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user