[all-commits] [llvm/llvm-project] 38de1c: [JSON] Display errors associated with Paths in con...
Sam McCall via All-commits
all-commits at lists.llvm.org
Wed Sep 23 15:34:39 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 38de1c33a8374bb16abfb024a973d851c170bafc
https://github.com/llvm/llvm-project/commit/38de1c33a8374bb16abfb024a973d851c170bafc
Author: Sam McCall <sam.mccall at gmail.com>
Date: 2020-09-24 (Thu, 24 Sep 2020)
Changed paths:
M llvm/include/llvm/Support/JSON.h
M llvm/lib/Support/JSON.cpp
M llvm/unittests/Support/JSONTest.cpp
Log Message:
-----------
[JSON] Display errors associated with Paths in context
When an error occurs processing a JSON object, seeing the actual
surrounding data helps. Dumping just the node where the problem
was identified can be too much or too little information.
printErrorContext() shows the error message in its context, as a comment.
JSON values along the path to the broken place are shown in some detail,
the rest of the document is elided. For example:
```
{
"credentials": [
{
"username": /* error: expected string */ 42,
"password": "secret"
},
{ ... }
]
"backups": { ... }
}
```
Differential Revision: https://reviews.llvm.org/D88103
More information about the All-commits
mailing list