void OglGenErr(oglplus::Error &err) { std::cerr << "Error (in " << err.GLSymbol() << ", " << err.ClassName() << ": '" << err.ObjectDescription() << "'): " << err.what() << " [" << err.File() << ":" << err.Line() << "] "; std::cerr << std::endl; auto i = err.Properties().begin(), e = err.Properties().end(); for (auto &i : err.Properties()) std::cerr << "<" << i.first << "='" << i.second << "'>" << std::endl; err.Cleanup(); }
void ExampleFormatErrorMessage( oglplus::Error& error, std::ostream& output ) { output << "'" << error.what() << "' in '" << error.GLFunc() << "' at [" << error.SourceFile() << ":" << error.SourceLine() << "]" << std::endl; }
inline wxString MakeCommonErrorMessage(oglplus::Error& error) { wxString message; message.Append(wxString::Format( wxT("Error: '%s'\r\n"), wxString(error.what(), wxConvLocal).c_str())); if(error.SourceFile()) { message.Append(wxString::Format( wxT("Source file: '%s'\r\n"), wxString(error.SourceFile(), wxConvLocal).c_str())); } if(error.SourceLine()) { message.Append( wxString::Format(wxT("Source line: '%d'\r\n"), error.SourceLine())); } if(error.SourceFunc()) { message.Append(wxString::Format( wxT("Source function: '%s'\r\n"), wxString(error.SourceFunc(), wxConvLocal).c_str())); } if(error.GLFunc()) { message.Append(wxString::Format( wxT("GL function: '%s'\r\n"), wxString(error.GLFunc(), wxConvLocal).c_str())); } if(error.EnumParam() || error.EnumParamName()) { message.Append(wxT("GL constant: ")); if(error.EnumParamName()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.EnumParamName(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(0x%x)\r\n"), error.EnumParam())); } } if(error.BindTarget() || error.TargetName()) { message.Append(wxT("Binding point: ")); if(error.TargetName()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.TargetName(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(0x%x)\r\n"), error.BindTarget())); } } if(error.ObjectTypeName() || error.ObjectType()) { message.Append(wxT("Object type: ")); if(error.ObjectTypeName()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.ObjectTypeName(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(0x%x)\r\n"), error.ObjectType())); } } if((!error.ObjectDesc().empty()) || (error.ObjectName() >= 0)) { message.Append(wxT("Object: ")); if(!error.ObjectDesc().empty()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.ObjectDesc().c_str(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(%d)\r\n"), error.ObjectName())); } } if(error.SubjectTypeName() || error.SubjectType()) { message.Append(wxT("Subject type: ")); if(error.SubjectTypeName()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.SubjectTypeName(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(%d)\r\n"), error.SubjectType())); } } if((!error.SubjectDesc().empty()) || (error.SubjectName() >= 0)) { message.Append(wxT("Subject: ")); if(!error.SubjectDesc().empty()) { message.Append(wxString::Format( wxT("'%s'\r\n"), wxString(error.SubjectDesc().c_str(), wxConvLocal).c_str())); } else { message.Append( wxString::Format(wxT("(%d)\r\n"), error.SubjectName())); } } return message; }