9 #include "COLLADASaxFWLIError.h"
10 #include "COLLADASaxFWLSaxFWLError.h"
11 #include "COLLADASaxFWLSaxParserError.h"
13 #include "GeneratedSaxParserParserError.h"
31 std::string error_context;
32 std::string error_message;
34 if (
error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER) {
35 error_context =
"Schema validation";
37 COLLADASaxFWL::SaxParserError *saxParserError = (COLLADASaxFWL::SaxParserError *)
error;
38 const GeneratedSaxParser::ParserError &parserError = saxParserError->getError();
39 error_message = parserError.getErrorMessage();
41 if (parserError.getErrorType() ==
42 GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
43 if (
STREQ(parserError.getElement(),
"effect")) {
48 else if (parserError.getErrorType() ==
49 GeneratedSaxParser::ParserError::
50 ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
51 if (!(
STREQ(parserError.getElement(),
"extra") &&
52 STREQ(parserError.getAdditionalText().c_str(),
"sibling: fx_profile_abstract"))) {
57 else if (parserError.getErrorType() ==
58 GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE) {
60 error_context =
"File access";
63 else if (parserError.getErrorType() ==
64 GeneratedSaxParser::ParserError::ERROR_REQUIRED_ATTRIBUTE_MISSING) {
69 isError = (parserError.getSeverity() !=
70 GeneratedSaxParser::ParserError::Severity::SEVERITY_ERROR_NONCRITICAL);
73 else if (
error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL) {
74 error_context =
"Sax FWL";
75 COLLADASaxFWL::SaxFWLError *saxFWLError = (COLLADASaxFWL::SaxFWLError *)
error;
76 error_message = saxFWLError->getErrorMessage();
83 isError = (saxFWLError->getSeverity() != COLLADASaxFWL::IError::SEVERITY_ERROR_NONCRITICAL);
86 error_context =
"OpenCollada";
87 error_message =
error->getFullErrorMessage();
91 std::string severity = (isError) ?
"Error" :
"Warning";
92 std::cout << error_context <<
" (" << severity <<
"): " << error_message << std::endl;
94 std::cout <<
"The Collada import has been forced to stop." << std::endl;
95 std::cout <<
"Please fix the reported error and then try again.";
virtual bool handleError(const COLLADASaxFWL::IError *error)
static void error(const char *str)