mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Add JSON error when value does not parse in Ini object.
If the JSON value fails to parse it is helpful to have the error message, at least for debugging.
This commit is contained in:
parent
da6b4abc58
commit
cb7a5f1ef3
@ -408,7 +408,11 @@ iniLoad(
|
||||
lineEqual = strstr(lineEqual + 1, "=");
|
||||
|
||||
if (lineEqual == NULL)
|
||||
THROW_FMT(FormatError, "invalid JSON value at line %u: %s", lineIdx + 1, linePtr);
|
||||
{
|
||||
THROW_FMT(
|
||||
FormatError, "invalid JSON value at line %u '%s': %s", lineIdx + 1, linePtr,
|
||||
errorMessage());
|
||||
}
|
||||
|
||||
// Try again with = in new position
|
||||
retry = true;
|
||||
|
@ -49,7 +49,8 @@ testRun(void)
|
||||
iniBuf = BUFSTRZ("[section]\nkey=value\n");
|
||||
|
||||
TEST_ERROR(
|
||||
iniLoad(ioBufferReadNew(iniBuf), testIniLoadCallback, result), FormatError, "invalid JSON value at line 2: key=value");
|
||||
iniLoad(ioBufferReadNew(iniBuf), testIniLoadCallback, result), FormatError,
|
||||
"invalid JSON value at line 2 'key=value': invalid type at 'value'");
|
||||
|
||||
// Key outside of section
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user