PICARD-2885: Fix file permission and not found error icons not being shown

Majority of file errors happen inside mutagen and are wrapped into a
MutagenError. This hid the handling of the specific error conditions
for permission and file not found errors.
This commit is contained in:
Philipp Wolfer
2024-05-03 10:36:02 +02:00
parent a26312cd91
commit eeaf8d90d9

View File

@@ -211,13 +211,13 @@ class File(QtCore.QObject, Item):
def _set_error(self, error):
self.state = File.ERROR
if any_exception_isinstance(error, MutagenError):
self.error_type = FileErrorType.PARSER
self.error_append(_("The file failed to parse, either the file is damaged or has an unsupported file format."))
elif any_exception_isinstance(error, FileNotFoundError):
if any_exception_isinstance(error, FileNotFoundError):
self.error_type = FileErrorType.NOTFOUND
elif any_exception_isinstance(error, PermissionError):
self.error_type = FileErrorType.NOACCESS
elif any_exception_isinstance(error, MutagenError):
self.error_type = FileErrorType.PARSER
self.error_append(_("The file failed to parse, either the file is damaged or has an unsupported file format."))
else:
self.error_type = FileErrorType.UNKNOWN
self.error_append(str(error))