You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-17 01:12:23 +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:
@ -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
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user