Add better logging for file open and write errors

This commit is contained in:
Jonas Kvinge
2021-08-09 23:32:26 +02:00
parent 7d61d8e646
commit f1d3cadb3b
15 changed files with 120 additions and 41 deletions

View File

@@ -708,7 +708,11 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
// Load new CUE songs
QFile cue_file(matching_cue);
if (!cue_file.exists() || !cue_file.open(QIODevice::ReadOnly)) return;
if (!cue_file.exists()) return;
if (!cue_file.open(QIODevice::ReadOnly)) {
qLog(Error) << "Could not open CUE file" << matching_cue << "for reading:" << cue_file.errorString();
return;
}
const SongList songs = cue_parser_->Load(&cue_file, matching_cue, path, false);
cue_file.close();
@@ -783,7 +787,12 @@ SongList CollectionWatcher::ScanNewFile(const QString &file, const QString &path
if (cues_processed->contains(matching_cue)) return songs;
QFile cue_file(matching_cue);
if (!cue_file.exists() || !cue_file.open(QIODevice::ReadOnly)) return songs;
if (!cue_file.exists()) return songs;
if (!cue_file.open(QIODevice::ReadOnly)) {
qLog(Error) << "Could not open CUE file" << matching_cue << "for reading:" << cue_file.errorString();
return songs;
}
// Ignore FILEs pointing to other media files.
// Also, watch out for incorrect media files.