mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Add XML to invalid XML error message.
There have been cases where pgBackRest has failed on invalid XML but it is not possible to determine what was wrong with the XML. This will only work for XML up to about 8KiB (which is the error message limit) but it should work in most cases.
This commit is contained in:
parent
10038db9c9
commit
67bdf07e69
@ -374,7 +374,7 @@ xmlDocumentNewBuf(const Buffer *buffer)
|
||||
*this = (XmlDocument){{0}}; // Extra braces are required for older gcc versions
|
||||
|
||||
if ((this->xml = xmlReadMemory((const char *)bufPtrConst(buffer), (int)bufUsed(buffer), "noname.xml", NULL, 0)) == NULL)
|
||||
THROW_FMT(FormatError, "invalid xml");
|
||||
THROW_FMT(FormatError, "invalid xml in %zu byte(s):\n%s", bufUsed(buffer), strZ(strNewBuf(buffer)));
|
||||
|
||||
// Set callback to ensure xml document is freed
|
||||
memContextCallbackSet(objMemContext(this), xmlDocumentFreeResource, this);
|
||||
|
@ -13,7 +13,8 @@ testRun(void)
|
||||
// *****************************************************************************************************************************
|
||||
if (testBegin("xml*()"))
|
||||
{
|
||||
TEST_ERROR(xmlDocumentNewBuf(bufNewC(BOGUS_STR, strlen(BOGUS_STR))), FormatError, "invalid xml");
|
||||
TEST_ERROR(
|
||||
xmlDocumentNewBuf(bufNewC(BOGUS_STR, strlen(BOGUS_STR))), FormatError, "invalid xml in 5 byte(s):\nBOGUS");
|
||||
|
||||
XmlDocument *xmlDocument = NULL;
|
||||
TEST_ASSIGN(
|
||||
|
Loading…
Reference in New Issue
Block a user