mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4429 Implement return status handling for command file interface
This commit is contained in:
@@ -57,7 +57,7 @@ void RicfSetTimeStep::setTimeStepIndex(int timeStepIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfSetTimeStep::execute()
|
||||
RicfCommandResponse RicfSetTimeStep::execute()
|
||||
{
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
|
||||
@@ -74,14 +74,28 @@ void RicfSetTimeStep::execute()
|
||||
}
|
||||
if (!foundCase)
|
||||
{
|
||||
RiaLogging::error(QString("setTimeStep: Could not find case with ID %1").arg(m_caseId()));
|
||||
return;
|
||||
QString error = QString("setTimeStep: Could not find case with ID %1").arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
}
|
||||
|
||||
int maxTimeStep = eclipseCase->timeStepStrings().size() - 1;
|
||||
if (m_timeStepIndex() > maxTimeStep)
|
||||
{
|
||||
QString error = QString("setTimeStep: Step %1 is larger than the maximum of %2 for case %3")
|
||||
.arg(m_timeStepIndex())
|
||||
.arg(maxTimeStep)
|
||||
.arg(m_caseId());
|
||||
RiaLogging::error(error);
|
||||
return RicfCommandResponse(RicfCommandResponse::COMMAND_ERROR, error);
|
||||
}
|
||||
|
||||
for (Rim3dView* view : eclipseCase->views())
|
||||
{
|
||||
view->setCurrentTimeStepAndUpdate(m_timeStepIndex);
|
||||
view->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user