render: add diagnostics for worker graph load failures

- Report QFile::errorString() when ProjectSerializer::Load() fails to open
  the graph file, so the worker log shows why instead of an empty detail.
- In olive-render-worker LoadGraph(), check file existence, size and
  readability before delegating to the serializer and log the attempt.
This commit is contained in:
2026-07-13 13:25:25 +08:00
parent 3abb4ff75b
commit 5a5ad3bc14
2 changed files with 21 additions and 1 deletions
+4 -1
View File
@@ -96,7 +96,10 @@ ProjectSerializer::Result ProjectSerializer::Load(Project *project,
return inner_result;
}
} else {
return kFileError;
Result r(kFileError);
r.SetDetails(QStringLiteral("Unable to open '%1': %2")
.arg(filename, project_file.errorString()));
return r;
}
}
+17
View File
@@ -24,6 +24,7 @@
#include <optional>
#include <QFile>
#include <QFileInfo>
#include <QGuiApplication>
#include <QJsonDocument>
#include <QJsonObject>
@@ -263,6 +264,22 @@ private:
bool LoadGraph(const QString &path)
{
{
QFileInfo fi(path);
if (!fi.exists()) {
LogError(QStringLiteral("LoadGraph: graph file does not exist: %1").arg(path));
return Write(ErrorMessage(QStringLiteral("graph file does not exist: %1").arg(path)));
}
if (fi.size() == 0) {
LogError(QStringLiteral("LoadGraph: graph file is empty: %1").arg(path));
return Write(ErrorMessage(QStringLiteral("graph file is empty: %1").arg(path)));
}
LogError(QStringLiteral("LoadGraph: loading %1 (%2 bytes, readable=%3)")
.arg(path)
.arg(fi.size())
.arg(fi.isReadable()));
}
auto loaded = std::make_unique<olive::Project>();
// Do not call Initialize() here: project serializers expect a blank
// project (root_ == nullptr) and will set root themselves. Calling