Code shuffle so function has only one exit point.

This commit is contained in:
Nathan Letwory 2011-09-12 10:57:41 +00:00
parent 46aede579e
commit 4a9a0ec3e4

@ -49,6 +49,8 @@ ErrorHandler::~ErrorHandler()
//--------------------------------------------------------------------
bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
{
mError = true;
if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER )
{
COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
@ -59,32 +61,29 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
{
if ( strcmp(parserError.getElement(), "effect") == 0 )
{
return false;
mError = false;
}
}
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT)
{
if ( (strcmp(parserError.getElement(), "extra") == 0)
&& (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0))
if ( !((strcmp(parserError.getElement(), "extra") == 0)
&& (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
{
return false;
mError = false;
}
}
if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE)
{
std::cout << "Couldn't open file" << std::endl;
mError = true;
}
std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
mError = true;
}
else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL )
{
COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
mError = true;
}
return false;
}