summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsystems.com>2017-10-09 16:09:33 +0200
committerChristian Mollekopf <mollekopf@kolabsystems.com>2017-10-09 16:09:33 +0200
commit3f7fb279c7ad7bf6e70a4839c64c9cf5633301c4 (patch)
tree2b3f142a1a384c702deb8c6171b26142c41aeeab /common
parent393846f660802d53d6ff6744cea0c1fa05019ba3 (diff)
downloadsink-3f7fb279c7ad7bf6e70a4839c64c9cf5633301c4.tar.gz
sink-3f7fb279c7ad7bf6e70a4839c64c9cf5633301c4.zip
Error checking and debug output
Diffstat (limited to 'common')
-rw-r--r--common/domain/applicationdomaintype.cpp10
1 files changed, 7 insertions, 3 deletions
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
146 if (copyBlobs && value.canConvert<BLOB>()) { 146 if (copyBlobs && value.canConvert<BLOB>()) {
147 const auto oldPath = value.value<BLOB>().value; 147 const auto oldPath = value.value<BLOB>().value;
148 const auto newPath = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); 148 const auto newPath = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString();
149 QFile::copy(oldPath, newPath); 149 if (!QFile::copy(oldPath, newPath)) {
150 SinkWarning() << "Failed to copy file from: " << oldPath << "to: " << newPath;
151 }
150 memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath})); 152 memoryAdaptor.setProperty(property, QVariant::fromValue(BLOB{newPath}));
151 } else if (pruneReferences && value.canConvert<Reference>()) { 153 } else if (pruneReferences && value.canConvert<Reference>()) {
152 continue; 154 continue;
@@ -258,10 +260,12 @@ void ApplicationDomainType::setBlobProperty(const QByteArray &key, const QByteAr
258 const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString(); 260 const auto path = Sink::temporaryFileLocation() + "/" + QUuid::createUuid().toString();
259 QFile file(path); 261 QFile file(path);
260 if (!file.open(QIODevice::WriteOnly)) { 262 if (!file.open(QIODevice::WriteOnly)) {
261 SinkError() << "Failed to open the file for writing: " << file.errorString() << path<< " For property " << key; 263 SinkError() << "Failed to open the file for writing: " << file.errorString() << path << " For property " << key;
262 return; 264 return;
263 } 265 }
264 file.write(value); 266 if (file.write(value) < 0) {
267 SinkError() << "Failed to write to file: " << file.errorString() << path << " For property " << key;
268 }
265 //Ensure that the file is written to disk immediately 269 //Ensure that the file is written to disk immediately
266 file.close(); 270 file.close();
267 setProperty(key, QVariant::fromValue(BLOB{path})); 271 setProperty(key, QVariant::fromValue(BLOB{path}));