1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 23:37:59 +00:00

Merge pull request #12350 from Chocobo1/log

Improve logging for errors
This commit is contained in:
Mike Tzou 2020-04-03 00:20:54 +08:00 committed by GitHub
commit e7392de04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}
} }
} }