[projects/git-slug] Catch OSError and improve logging during file processing

baggins baggins at pld-linux.org
Sun Apr 19 18:11:32 CEST 2026


commit b85c869fc6dbf091c9637652e28e50236dfc9124
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Apr 19 18:11:08 2026 +0200

    Catch OSError and improve logging during file processing

 watch/slug_watch | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/watch/slug_watch b/watch/slug_watch
index b077de9..bdc8c18 100755
--- a/watch/slug_watch
+++ b/watch/slug_watch
@@ -68,7 +68,7 @@ def process_file(pathname):
         try:
             shutil.copyfile(PROJECTS_LIST_HEAD, PROJECTS_LIST_NEW)
         except (OSError, shutil.Error):
-            logger.error('Cannot write {}'.format(PROJECTS_LIST_NEW))
+            logger.exception('Cannot write {}'.format(PROJECTS_LIST_NEW))
 
     with open(os.path.join(REFREPO_WDIR, REFFILE),'w') as headfile_new, open(pathname, 'r') as newfile, \
             open(PROJECTS_LIST_NEW,'a') as projects:
@@ -86,8 +86,8 @@ def process_file(pathname):
                     if repo != oldtuple[0]:
                         print('packages/'+repo+'.git', file=projects)
                 oldtuple = (repo, ref)
-        except ValueError:
-            logger.error("Problem with file: {}".format(pathname))
+        except (ValueError, OSError):
+            logger.exception("Problem with file: {}".format(pathname))
             return
         process.wait()
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/b85c869fc6dbf091c9637652e28e50236dfc9124



More information about the pld-cvs-commit mailing list