23 #include "COLLADASaxFWLIError.h"
24 #include "COLLADASaxFWLSaxFWLError.h"
25 #include "COLLADASaxFWLSaxParserError.h"
27 #include "GeneratedSaxParserParserError.h"
45 std::string error_context;
46 std::string error_message;
48 if (
error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER) {
49 error_context =
"Schema validation";
51 COLLADASaxFWL::SaxParserError *saxParserError = (COLLADASaxFWL::SaxParserError *)
error;
52 const GeneratedSaxParser::ParserError &parserError = saxParserError->getError();
53 error_message = parserError.getErrorMessage();
55 if (parserError.getErrorType() ==
56 GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
57 if (
STREQ(parserError.getElement(),
"effect")) {
62 else if (parserError.getErrorType() ==
63 GeneratedSaxParser::ParserError::
64 ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
65 if (!(
STREQ(parserError.getElement(),
"extra") &&
66 STREQ(parserError.getAdditionalText().c_str(),
"sibling: fx_profile_abstract"))) {
71 else if (parserError.getErrorType() ==
72 GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE) {
74 error_context =
"File access";
77 else if (parserError.getErrorType() ==
78 GeneratedSaxParser::ParserError::ERROR_REQUIRED_ATTRIBUTE_MISSING) {
83 isError = (parserError.getSeverity() !=
84 GeneratedSaxParser::ParserError::Severity::SEVERITY_ERROR_NONCRITICAL);
87 else if (
error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL) {
88 error_context =
"Sax FWL";
89 COLLADASaxFWL::SaxFWLError *saxFWLError = (COLLADASaxFWL::SaxFWLError *)
error;
90 error_message = saxFWLError->getErrorMessage();
97 isError = (saxFWLError->getSeverity() != COLLADASaxFWL::IError::SEVERITY_ERROR_NONCRITICAL);
100 error_context =
"OpenCollada";
101 error_message =
error->getFullErrorMessage();
105 std::string severity = (isError) ?
"Error" :
"Warning";
106 std::cout << error_context <<
" (" << severity <<
"): " << error_message << std::endl;
108 std::cout <<
"The Collada import has been forced to stop." << std::endl;
109 std::cout <<
"Please fix the reported error and then try again.";
virtual bool handleError(const COLLADASaxFWL::IError *error)
static void error(const char *str)