Skip to content
Permalink
Browse files

runPrepared rethrows exceptions

  • Loading branch information
nyalldawson committed Jul 6, 2017
1 parent 90f10ae commit ebd346c407c526343ebfa19f6de2300a537388ab
@@ -334,10 +334,17 @@ QVariantMap QgsProcessingAlgorithm::run( const QVariantMap &parameters, 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 &parameters,
}
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();

0 comments on commit ebd346c

Please sign in to comment.
You can’t perform that action at this time.