本文整理汇总了C++中ErrorInfo类的典型用法代码示例。如果您正苦于以下问题:C++ ErrorInfo类的具体用法?C++ ErrorInfo怎么用?C++ ErrorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ErrorInfo
ItemReaderResult ItemReader::internalReadFile(const QString &filePath)
{
ASTCacheValue &cacheValue = (*m_astCache)[filePath];
if (cacheValue.isValid()) {
if (Q_UNLIKELY(cacheValue.isProcessing()))
throw ErrorInfo(Tr::tr("Loop detected when importing '%1'.").arg(filePath));
} else {
QFile file(filePath);
if (Q_UNLIKELY(!file.open(QFile::ReadOnly)))
throw ErrorInfo(Tr::tr("Cannot open '%1'.").arg(filePath));
m_filesRead.insert(filePath);
const QString code = QTextStream(&file).readAll();
QbsQmlJS::Lexer lexer(cacheValue.engine());
lexer.setCode(code, 1);
QbsQmlJS::Parser parser(cacheValue.engine());
file.close();
if (!parser.parse()) {
QList<QbsQmlJS::DiagnosticMessage> parserMessages = parser.diagnosticMessages();
if (Q_UNLIKELY(!parserMessages.isEmpty())) {
ErrorInfo err;
foreach (const QbsQmlJS::DiagnosticMessage &msg, parserMessages)
err.append(msg.message, toCodeLocation(filePath, msg.loc));
throw err;
}
}
示例2: generate
void ClangCompilationDatabaseGenerator::generate()
{
for (const Project &theProject : project().projects.values()) {
QJsonArray database;
const ProjectData projectData = theProject.projectData();
const QString buildDir = projectData.buildDirectory();
for (const ProductData &productData : projectData.allProducts()) {
for (const GroupData &groupData : productData.groups()) {
for (const ArtifactData &sourceArtifact : groupData.allSourceArtifacts()) {
if (!hasValidInputFileTag(sourceArtifact.fileTags()))
continue;
const QString filePath = sourceArtifact.filePath();
ErrorInfo errorInfo;
const RuleCommandList rules = theProject.ruleCommands(productData, filePath,
QStringLiteral("obj"),
&errorInfo);
if (errorInfo.hasError())
throw errorInfo;
for (const RuleCommand &rule : rules) {
if (rule.type() != RuleCommand::ProcessCommandType)
continue;
database.append(createEntry(filePath, buildDir, rule));
}
}
}
}
writeProjectDatabase(QDir(buildDir).filePath(DefaultDatabaseFileName), database);
}
}
示例3: CreateError
cpix_Error * CreateError(cpix_ErrorType errorType,
const char * msg)
{
ErrorInfo
* errorInfo = NULL;
try
{
errorInfo = AcquireErrorInfo();
errorInfo->setInfo(errorType,
msg);
}
catch (...)
{
logMsg(CPIX_LL_ERROR,
"!!! Failed to create error struct for type %d ...",
errorType);
logMsg(CPIX_LL_ERROR,
"!!! ... (cont'd) msg: %s. Will report CPIX error.",
msg == NULL ? "(null)" : msg);
errorInfo = & SyncErrorInfo;
errorInfo->setInfo(ET_CPIX_EXC);
}
cpix_Error
* rv = static_cast<cpix_Error*>(errorInfo);
return rv;
}
示例4: BuildGraphLocker
void InternalSetupProjectJob::start()
{
BuildGraphLocker *bgLocker = m_existingProject ? m_existingProject->bgLocker : 0;
try {
const ErrorInfo err = m_parameters.expandBuildConfiguration();
if (err.hasError())
throw err;
const QString projectId = TopLevelProject::deriveId(m_parameters.topLevelProfile(),
m_parameters.finalBuildConfigurationTree());
const QString buildDir
= TopLevelProject::deriveBuildDirectory(m_parameters.buildRoot(), projectId);
if (m_existingProject && m_existingProject->buildDirectory != buildDir)
m_existingProject.clear();
if (!m_existingProject) {
bgLocker = new BuildGraphLocker(ProjectBuildData::deriveBuildGraphFilePath(buildDir,
projectId),
logger());
}
execute();
if (m_existingProject)
m_existingProject->bgLocker = 0;
m_newProject->bgLocker = bgLocker;
} catch (const ErrorInfo &error) {
m_newProject.clear();
setError(error);
if (!m_existingProject)
delete bgLocker;
}
emit finished(this);
}
示例5: ErrorInfoCreate
ErrorInfo ErrorInfoCreate(ErrorInfo::Error error, EModule module, int line) {
ErrorInfo info;
info.set_error(error);
info.set_module(module);
info.set_line(line);
return info;
}
示例6: testCallingSequence1
void testCallingSequence1(uima::util::ConsoleUI& rclConsole, const TCHAR* cpszConfigFilename)
/* ----------------------------------------------------------------------- */
{
ErrorInfo errInfo;
uima::TextAnalysisEngine* pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
CAS* cas = pEngine->newCAS();
failIfNotTrue(cas != NULL);
uima::UnicodeStringRef us(UnicodeString("a"));
// UnicodeStringRef uRef(us);
rclConsole.formatHeader(_TEXT("testing Engine CallingSequence1"));
cas->setDocumentText(us.getBuffer(), us.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_NONE);
failIfNotTrue(cas->reset() == UIMA_ERR_NONE);
failIfNotTrue(pEngine->destroy() == UIMA_ERR_NONE);
cas->setDocumentText(us.getBuffer(), us.length());
cas->getDocumentAnnotation().setLanguage("en");
failIfNotTrue(pEngine->process(*cas) == UIMA_ERR_ENGINE_INVALID_CALLING_SEQUENCE);
TyErrorId deInitRC = pEngine->destroy();
rclConsole.format("RC of deInit()", deInitRC);
failIfNotTrue(deInitRC == UIMA_ERR_ENGINE_INVALID_CALLING_SEQUENCE);
rclConsole.formatBool(_TEXT("testing Engine CallingSequence1 OK"),
true); //lint !e944: argument for operator '!' always evaluates to False
delete cas;
delete pEngine;
} //lint !e715: cpszConfigFilename (line 99) not referenced
示例7: PNGWarning
static void PNGWarning(png_structp png, png_const_charp message)
{
ErrorInfo *errorInfo = png_get_error_ptr(png);
if (errorInfo != NULL && errorInfo->errorCB != NULL)
{
errorInfo->errorCB(message, false, errorInfo->errorCBContext);
}
}
示例8: productsToUse
void CommandLineFrontend::dumpNodesTree()
{
QFile stdOut;
stdOut.open(stdout, QIODevice::WriteOnly);
const ErrorInfo error = m_projects.front().dumpNodesTree(stdOut, productsToUse()
.value(m_projects.front()));
if (error.hasError())
throw error;
}
示例9: CheckError
/* Similar routine as above just with error info objects instead of err-ids.
This routine just does a hard program exit for any failure!
*/
static void CheckError(ErrorInfo const &errInfo) {
if (errInfo.getErrorId() != UIMA_ERR_NONE) {
cerr << endl << " *** ExampleApplication - Error info:" << endl
<< "Error string : "
<< AnalysisEngine::getErrorIdAsCString(errInfo.getErrorId())
<< errInfo << endl; /* (errInfo starts with a newline) */
exit((int) errInfo.getErrorId());
}
}
示例10: QBS_CHECK
void CommandLineFrontend::generate()
{
QBS_CHECK(!!m_generator);
const ErrorInfo error = m_generator->generate(m_projects,
m_parser.buildConfigurations(),
m_parser.installOptions(QString()),
m_parser.settingsDir(),
ConsoleLogger::instance(m_settings));
if (error.hasError())
throw error;
}
示例11: testDescriptorNotFound
void testDescriptorNotFound(uima::util::ConsoleUI& rclConsole)
/* ----------------------------------------------------------------------- */
{
rclConsole.info("testDescriptorNotFound start.");
uima::TextAnalysisEngine* pEngine;
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(_TEXT("DUMMY"), errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_RESOURCE_CORRUPTED);
failIfNotTrue(pEngine == NULL);
rclConsole.info("testDescriptorNotFound finished.");
}
示例12: testMissingResMgr
void testMissingResMgr(uima::util::ConsoleUI& rclConsole)
/* ----------------------------------------------------------------------- */
{
rclConsole.info("testMissingResMgr start.");
uima::TextAnalysisEngine* pEngine;
failIfNotTrue(!ResourceManager::hasInstance());
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(_TEXT("DUMMY"), errInfo);
failIfNotTrue(!ResourceManager::hasInstance());
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_ENGINE_RESMGR_NOT_INITIALIZED);
failIfNotTrue(pEngine == NULL);
rclConsole.info("testMissingResMgr finished.");
}
示例13: get
static
typename ErrorInfo::value_type *
get( exception const & x )
{
if( exception_detail::error_info_container * c=x.data_.get() )
if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
{
#ifndef BOOST_NO_RTTI
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
#endif
ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
return &w->value();
}
return 0;
}
示例14: RecordErrorInfo
// [R]
void CompileSession::RecordErrorInfo(const ErrorInfo& templ) {
DEBUG_FORMAT("%s", templ);
static bool fContinue = false;
if (!fContinue && ::IsDebuggerPresent()) {
__debugbreak();
fContinue = true;
}
if (error_set_.Contains(&templ)) {
return;
}
auto& error_info = templ.Clone();
error_set_.Add(&error_info);
auto ref = errors_.GetLast();
while (ref) {
if (error_info.source_info() > ref->source_info()) {
break;
}
ref = ref->GetPrev();
}
if (ref) {
errors_.InsertAfter(&error_info, ref);
} else {
errors_.Prepend(&error_info);
}
}
示例15: testCallingSequence2
void testCallingSequence2(uima::util::ConsoleUI& rclConsole, const TCHAR* cpszConfigFilename)
/* ----------------------------------------------------------------------- */
{
rclConsole.formatHeader(_TEXT("testing Engine CallingSequence2"));
{
uima::TextAnalysisEngine* pEngine = NULL;
ErrorInfo errInfo;
pEngine = TextAnalysisEngine::createTextAnalysisEngine(cpszConfigFilename, errInfo);
failIfNotTrue(errInfo.getErrorId() == UIMA_ERR_NONE);
failIfNotTrue(pEngine != NULL);
delete pEngine;
}
rclConsole.formatBool(_TEXT("testing Engine CallingSequence2 OK"),
true); //lint !e944: argument for operator '!' always evaluates to False
}