From 3f7fb279c7ad7bf6e70a4839c64c9cf5633301c4 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 9 Oct 2017 16:09:33 +0200 Subject: Error checking and debug output --- common/domain/applicationdomaintype.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index ee70c35..5cc89b3 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -146,7 +146,9 @@ void copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, Sink::Applicatio if (copyBlobs && value.canConvert()) { const auto oldPath = value.value().value; const auto newPath = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); - QFile::copy(oldPath, newPath); + if (!QFile::copy(oldPath, newPath)) { + SinkWarning() << "Failed to copy file from: " << oldPath << "to: " << newPath; + } memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath})); } else if (pruneReferences && value.canConvert()) { continue; @@ -258,10 +260,12 @@ void ApplicationDomainType::setBlobProperty(const QByteArray &key, const QByteAr const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); QFile file(path); if (!file.open(QIODevice::WriteOnly)) { - SinkError() << "Failed to open the file for writing: " << file.errorString() << path<< " For property " << key; + SinkError() << "Failed to open the file for writing: " << file.errorString() << path << " For property " << key; return; } - file.write(value); + if (file.write(value) < 0) { + SinkError() << "Failed to write to file: " << file.errorString() << path << " For property " << key; + } //Ensure that the file is written to disk immediately file.close(); setProperty(key, QVariant::fromValue(BLOB{path})); -- cgit v1.2.3