Suppress reports on some common exception throws

This commit is contained in:
James Turner 2021-02-19 17:39:14 +00:00 committed by Automatic Release Builder
parent b023c7c4f4
commit 747d99450b
2 changed files with 37 additions and 33 deletions

View File

@ -75,13 +75,13 @@ BuilderException::BuilderException()
}
BuilderException::BuilderException(const char* message, const char* origin)
: sg_exception(message, origin)
: sg_exception(message, origin, {}, false)
{
}
BuilderException::BuilderException(const std::string& message,
const std::string& origin)
: sg_exception(message, origin)
: sg_exception(message, origin, {}, false)
{
}

View File

@ -244,40 +244,43 @@ readXML (istream &input, XMLVisitor &visitor, const string &path)
// FIXME: get proper error string from system
if (!input.good()) {
sg_io_exception ex ("Problem reading file",
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser");
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
sg_io_exception ex("Problem reading file",
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser",
false /* don't report */);
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
}
input.read(buf,16384);
if (!XML_Parse(parser, buf, input.gcount(), false)) {
sg_io_exception ex (XML_ErrorString(XML_GetErrorCode(parser)),
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser");
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
sg_io_exception ex(XML_ErrorString(XML_GetErrorCode(parser)),
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser",
false /* don't report */);
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
}
}
// Verify end of document.
if (!XML_Parse(parser, buf, 0, true)) {
sg_io_exception ex (XML_ErrorString(XML_GetErrorCode(parser)),
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser");
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
sg_io_exception ex(XML_ErrorString(XML_GetErrorCode(parser)),
sg_location(path,
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser",
false /* don't report */);
visitor.setParser(0);
XML_ParserFree(parser);
throw ex;
}
visitor.setParser(0);
@ -300,8 +303,8 @@ readXML (const SGPath &path, XMLVisitor &visitor)
throw;
}
} else {
throw sg_io_exception("Failed to open file", sg_location(path),
"SimGear XML Parser");
throw sg_io_exception("Failed to open file", sg_location(path),
"SimGear XML Parser", false /* don't report */);
}
input.close();
}
@ -318,11 +321,12 @@ readXML (const char *buf, const int size, XMLVisitor &visitor)
visitor.startXML();
if (!XML_Parse(parser, buf, size, false)) {
sg_io_exception ex (XML_ErrorString(XML_GetErrorCode(parser)),
sg_location("In-memory XML buffer",
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser");
sg_io_exception ex(XML_ErrorString(XML_GetErrorCode(parser)),
sg_location("In-memory XML buffer",
XML_GetCurrentLineNumber(parser),
XML_GetCurrentColumnNumber(parser)),
"SimGear XML Parser",
false /* don't report */);
XML_ParserFree(parser);
throw ex;
}