Skip to content

Commit

Permalink
Update placeholder filter warnings to errors in preflight/execute
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarquisbq authored and imikejackson committed Dec 10, 2023
1 parent 778cd90 commit 590129e
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions src/complex/Pipeline/PipelineFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,21 @@ bool PipelineFilter::preflight(DataStructure& data, RenamedPaths& renamedPaths,
IFilter::MessageHandler messageHandler{[this](const IFilter::Message& message) { this->notifyFilterMessage(message); }};

clearFaultState();
IFilter::PreflightResult result;
if(m_Filter != nullptr)
{
result = m_Filter->preflight(data, getArguments(), messageHandler, shouldCancel);
m_Warnings = std::move(result.outputActions.warnings());
}
else
if(m_Filter == nullptr)
{
m_Warnings.push_back(Warning{-10, "This filter is just a placeholder! The original filter could not be found. See the filter comments for more details."});
m_Errors.push_back(Error{-10, "This filter is just a placeholder! The original filter could not be found. See the filter comments for more details."});
setHasErrors();
setPreflightStructure(data, false);
sendFilterFaultMessage(m_Index, getFaultState());
sendFilterFaultDetailMessage(m_Index, m_Warnings, m_Errors);
return false;
}

IFilter::PreflightResult result = m_Filter->preflight(data, getArguments(), messageHandler, shouldCancel);
m_Warnings = std::move(result.outputActions.warnings());
setHasWarnings(!m_Warnings.empty());
m_PreflightValues = std::move(result.outputValues);

if(result.outputActions.invalid())
{
m_Errors = std::move(result.outputActions.errors());
Expand Down Expand Up @@ -251,22 +254,25 @@ bool PipelineFilter::execute(DataStructure& data, const std::atomic_bool& should

IFilter::MessageHandler messageHandler{[this](const IFilter::Message& message) { this->notifyFilterMessage(message); }};

if(m_Filter == nullptr)
{
m_Errors.push_back(Error{-11, "This filter is just a placeholder! The original filter could not be found. See the filter comments for more details."});
}

IFilter::ExecuteResult result;
if(m_Filter != nullptr)
{
result = m_Filter->execute(data, getArguments(), this, messageHandler, shouldCancel);
m_Warnings = result.result.warnings();
m_PreflightValues = std::move(result.outputValues);
if(result.result.invalid())
{
m_Errors = result.result.errors();
}
}
else
{
m_Warnings.push_back(Warning{-11, "This filter is just a placeholder! The original filter could not be found. See the filter comments for more details."});
}

m_PreflightValues = std::move(result.outputValues);

if(result.result.invalid())
{
m_Errors = result.result.errors();
m_Errors.push_back(Error{-11, "This filter is just a placeholder! The original filter could not be found. See the filter comments for more details."});
}

setHasWarnings(!m_Warnings.empty());
Expand All @@ -281,7 +287,7 @@ bool PipelineFilter::execute(DataStructure& data, const std::atomic_bool& should
this->sendFilterRunStateMessage(m_Index, complex::RunState::Idle);
this->sendFilterUpdateMessage(m_Index, "End");

return result.result.valid();
return result.result.valid() && m_Filter != nullptr;
}

std::vector<DataPath> PipelineFilter::getCreatedPaths() const
Expand Down

0 comments on commit 590129e

Please sign in to comment.