✨ Exception logging on filename sanitization and download watcher.

This commit is contained in:
Robert Honz
2024-04-22 07:58:32 +02:00
parent c3519c54a5
commit 840f23d252
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -810,7 +810,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.s_queue_download_item_finished.emit(item) self.s_queue_download_item_finished.emit(item)
elif result == QueueDownloadStatus.Skipped: elif result == QueueDownloadStatus.Skipped:
self.s_queue_download_item_skipped.emit(item) self.s_queue_download_item_skipped.emit(item)
except: except e:
logger_gui.error(e)
self.s_queue_download_item_failed.emit(item) self.s_queue_download_item_failed.emit(item)
else: else:
time.sleep(2) time.sleep(2)
+2 -1
View File
@@ -207,7 +207,6 @@ def path_file_sanitize(path_file: str, adapt: bool = False, uniquify: bool = Fal
filename_sanitized = filename_sanitized[: -len(file_suffix)] + file_suffix filename_sanitized = filename_sanitized[: -len(file_suffix)] + file_suffix
except ValidationError as e: except ValidationError as e:
# TODO: Implement proper exception handling and logging. # TODO: Implement proper exception handling and logging.
# print(e)
# Hacky stuff, since the sanitizing function does not shorten the filename somehow (bug?) # Hacky stuff, since the sanitizing function does not shorten the filename somehow (bug?)
# TODO: Remove after pathvalidate update. # TODO: Remove after pathvalidate update.
# If filename too long # If filename too long
@@ -218,6 +217,8 @@ def path_file_sanitize(path_file: str, adapt: bool = False, uniquify: bool = Fal
+ FILENAME_SANITIZE_PLACEHOLDER + FILENAME_SANITIZE_PLACEHOLDER
+ file_extension + file_extension
) )
else:
print(e)
# Join path and filename # Join path and filename
result: str = os.path.join(pathname_sanitized, filename_sanitized) result: str = os.path.join(pathname_sanitized, filename_sanitized)