From 1995fe671354dee47e937fc406312f3a22744ba5 Mon Sep 17 00:00:00 2001 From: Takeshi Nakazato Date: Mon, 20 Jan 2025 13:46:16 +0900 Subject: [PATCH] Fix error message handling in except blocks --- casaconfig/private/data_update.py | 4 ++-- casaconfig/private/pull_data.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/casaconfig/private/data_update.py b/casaconfig/private/data_update.py index de1e80f..5d7fc60 100644 --- a/casaconfig/private/data_update.py +++ b/casaconfig/private/data_update.py @@ -330,7 +330,7 @@ def data_update(path=None, version=None, force=False, logger=None, auto_update_r except BadLock as exc: # the path is known to exist so this means that the lock file was not empty and it's not locked - msgs = str(exc) + msgs = [str(exc)] msgs.append('data_update: the lock file at %s is not empty.' % path) msgs.append('A previous attempt to update path may have failed or exited prematurely.') msgs.append('Remove the lock file and set force to True with the desired version (default to most recent).') @@ -341,7 +341,7 @@ def data_update(path=None, version=None, force=False, logger=None, auto_update_r except BadReadme as exc: # something is wrong in the readme after an update was triggered, this shouldn't happen, print more context reraise this - msgs = str(exc) + msgs = [str(exc)] msgs.append('This should not happen unless multiple sessions are trying to update data at the same time and one experienced problems or was done out of sequence') msgs.append('Check for other updates in progress or choose a different path or clear out this path and try again using pull_data or update_all') print_log_messages(msgs, logger, True) diff --git a/casaconfig/private/pull_data.py b/casaconfig/private/pull_data.py index 1ebc157..12c21b6 100644 --- a/casaconfig/private/pull_data.py +++ b/casaconfig/private/pull_data.py @@ -283,7 +283,7 @@ def pull_data(path=None, version=None, force=False, logger=None, verbose=None): except BadLock as exc: # the path is known to exist so this means that the lock file was not empty and it's not locked - msgs = str(exc) + msgs = [str(exc)] msgs.append('The lock file at %s is not empty.' % path) msgs.append('A previous attempt to update path may have failed or exited prematurely.') msgs.append('It may be best to completely repopulated path using pull_data and measures_update.') @@ -292,7 +292,7 @@ def pull_data(path=None, version=None, force=False, logger=None, verbose=None): raise except BadReadme as exc: # something is wrong in the readme after an update was triggered and locked, this shouldn't happen, print more context and reraise this - msgs = str(exc) + msgs = [str(exc)] msgs.append('This should not happen unless multiple sessions are trying to update data at the same time and one experienced problems or was done out of sequence') msgs.append('Check for other updates in progress or choose a different path or clear out this path and try again') print_log_messages(msgs, logger, True)