From 8c706357f477917959fe2d1912909db6675d3e49 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 25 Oct 2015 23:39:29 +0900 Subject: [PATCH] Report error received from zip_close We may want to hide the error text in a release build and replace it with something more user friendly but then again, the next time this fails on us at least our users can report more than "doesn't work"... Signed-off-by: Dirk Hohndel --- qt-ui/subsurfacewebservices.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 5e2316d30..7c67ecc67 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -253,8 +253,16 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, qDebug() << errPrefix << "failed to include dive:" << i; } } - zip_close(zip); xsltFreeStylesheet(xslt); + if (zip_close(zip)) { + int ze, se; + zip_error_t *error = zip_get_error(zip); + ze = zip_error_code_zip(error); + se = zip_error_code_system(error); + report_error(qPrintable(tr("error writing zip file: %s zip error %d system error %d - %s")), + qPrintable(QDir::toNativeSeparators(tempfile)), ze, se, zip_strerror(zip)); + return false; + } return true; error_close_zip: