mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-02 22:25:17 +00:00
spa: improve JSON error reporting in spa-json-dump
This commit is contained in:
parent
04c5d3958b
commit
a9fdc6a408
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa/debug/file.h>
|
||||
|
||||
static void encode_string(FILE *f, const char *val, int len)
|
||||
{
|
||||
|
@ -143,8 +144,9 @@ static int process_json(const char *filename, void *buf, size_t size)
|
|||
struct spa_error_location loc;
|
||||
|
||||
if (spa_json_get_error(&it, buf, &loc))
|
||||
fprintf(stderr, "syntax error in file '%s': at line:%d col:%d: %s\n",
|
||||
filename, loc.line, loc.col, loc.reason);
|
||||
spa_debug_file_error_location(stderr, &loc,
|
||||
"syntax error in file '%s': %s",
|
||||
filename, loc.reason);
|
||||
else
|
||||
fprintf(stderr, "error parsing file '%s': %s\n", filename, spa_strerror(res));
|
||||
|
||||
|
|
|
@ -1317,8 +1317,7 @@ static int get_data_from_json(struct data *data, const char *json_path)
|
|||
|
||||
if (spa_json_get_error(&it[0], json, &loc)) {
|
||||
spa_debug_file_error_location(stderr, &loc,
|
||||
"JSON syntax error: %s\n",
|
||||
loc.reason);
|
||||
"JSON syntax error: %s\n", loc.reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue