feat: add sink fail reason and correctly propagate it through the NetRequest

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2025-05-07 10:11:45 +03:00
parent a89fc7d1e0
commit c3749c4fdc
7 changed files with 36 additions and 8 deletions

View File

@@ -58,6 +58,7 @@ class ByteArraySink : public Sink {
qWarning() << "ByteArraySink did not initialize the buffer because it's not addressable";
if (initAllValidators(request))
return Task::State::Running;
m_fail_reason = "Failed to initialize validators";
return Task::State::Failed;
};
@@ -69,12 +70,14 @@ class ByteArraySink : public Sink {
qWarning() << "ByteArraySink did not write the buffer because it's not addressable";
if (writeAllValidators(data))
return Task::State::Running;
m_fail_reason = "Failed to write validators";
return Task::State::Failed;
}
auto abort() -> Task::State override
{
failAllValidators();
m_fail_reason = "Aborted";
return Task::State::Failed;
}
@@ -82,12 +85,13 @@ class ByteArraySink : public Sink {
{
if (finalizeAllValidators(reply))
return Task::State::Succeeded;
m_fail_reason = "Failed to finalize validators";
return Task::State::Failed;
}
auto hasLocalData() -> bool override { return false; }
private:
protected:
std::shared_ptr<QByteArray> m_output;
};
} // namespace Net