mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
runPrepared rethrows exceptions
This commit is contained in:
parent
90f10ae853
commit
ebd346c407
@ -334,10 +334,17 @@ QVariantMap QgsProcessingAlgorithm::run( const QVariantMap ¶meters, QgsProce
|
||||
if ( !res )
|
||||
return QVariantMap();
|
||||
|
||||
QVariantMap runRes = alg->runPrepared( parameters, context, feedback );
|
||||
|
||||
if ( !alg->mHasExecuted )
|
||||
QVariantMap runRes;
|
||||
try
|
||||
{
|
||||
runRes = alg->runPrepared( parameters, context, feedback );
|
||||
}
|
||||
catch ( QgsProcessingException &e )
|
||||
{
|
||||
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
|
||||
feedback->reportError( e.what() );
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
if ( ok )
|
||||
*ok = true;
|
||||
@ -410,17 +417,15 @@ QVariantMap QgsProcessingAlgorithm::runPrepared( const QVariantMap ¶meters,
|
||||
}
|
||||
return runResults;
|
||||
}
|
||||
catch ( QgsProcessingException &e )
|
||||
catch ( QgsProcessingException & )
|
||||
{
|
||||
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
|
||||
feedback->reportError( e.what() );
|
||||
|
||||
if ( mLocalContext )
|
||||
{
|
||||
// see above!
|
||||
mLocalContext->pushToThread( context.thread() );
|
||||
}
|
||||
return QVariantMap();
|
||||
//rethrow
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,10 @@ bool QgsProcessingAlgRunnerTask::run()
|
||||
mResults = mAlgorithm->runPrepared( mParameters, mContext, mFeedback );
|
||||
ok = true;
|
||||
}
|
||||
catch ( QgsProcessingException & )
|
||||
catch ( QgsProcessingException &e )
|
||||
{
|
||||
QgsMessageLog::logMessage( e.what(), QObject::tr( "Processing" ), QgsMessageLog::CRITICAL );
|
||||
mFeedback->reportError( e.what() );
|
||||
return false;
|
||||
}
|
||||
return ok && !mFeedback->isCanceled();
|
||||
|
Loading…
x
Reference in New Issue
Block a user