From c3a22e434b3144746debef2bf63813520ea041c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de>
Date: Sun, 13 Oct 2024 23:24:06 +0200
Subject: [PATCH] Fix sorter exception catching

---
 jobs/source_file_sorter/job.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jobs/source_file_sorter/job.py b/jobs/source_file_sorter/job.py
index b6fee7c..8fde6a0 100644
--- a/jobs/source_file_sorter/job.py
+++ b/jobs/source_file_sorter/job.py
@@ -359,7 +359,7 @@ def _sort_medium(session: SessionDb, own_job_id: int, db_path: str):
             # Set AFTER moving the file, as moving is more likely to throw exception than setting the variable
             # Note that with an exception the medium variables will still be updated in the database
             medium.file_path = _get_db_path(dest_file)
-    except Exception as e:
+    except IOError as e:  # Don't catch stuff like database errors
         logger.error("Exception while sorting medium", exc_info=e)
         medium.sorter_error_message = f"Exception while sorting: {e}"
         medium.lecture_id = None
-- 
GitLab