Browse Source

Improve logging for errors

This commit also allows the strings to be translated.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
17f608685d
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 9
      src/base/bittorrent/private/resumedatasavingmanager.cpp

9
src/base/bittorrent/private/resumedatasavingmanager.cpp

@ -44,12 +44,9 @@ void ResumeDataSavingManager::save(const QString &filename, const QByteArray &da
const QString filepath = m_resumeDataDir.absoluteFilePath(filename); const QString filepath = m_resumeDataDir.absoluteFilePath(filename);
QSaveFile file {filepath}; QSaveFile file {filepath};
if (file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly) || (file.write(data) != data.size()) || !file.commit()) {
file.write(data); LogMsg(tr("Couldn't save data to '%1'. Error: %2")
if (!file.commit()) { .arg(filepath, file.errorString()), Log::CRITICAL);
Logger::instance()->addMessage(QString("Couldn't save data in '%1'. Error: %2")
.arg(filepath, file.errorString()), Log::WARNING);
}
} }
} }

Loading…
Cancel
Save