Skip to content

Commit ebc218e

Browse files
committed
Fixed minor issues in shuffle tools cache
1 parent 828ac76 commit ebc218e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

shuffle-tools/1.2.0/src/app.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,9 @@ def merge_lists(self, list_one, list_two, set_field="", sort_key_list_one="", so
13691369
except json.decoder.JSONDecodeError as e:
13701370
self.logger.info("Failed to parse list2 as json: %s" % e)
13711371

1372+
if not isinstance(list_one, list) or not isinstance(list_two, list):
1373+
return {"success": False, "message": "Input lists need to be valid JSON lists."}
1374+
13721375
if len(list_one) != len(list_two):
13731376
return {"success": False, "message": "Lists length must be the same. %d vs %d" % (len(list_one), len(list_two))}
13741377

@@ -1573,8 +1576,8 @@ def check_cache_contains(self, key, value, append):
15731576
if isinstance(value, dict) or isinstance(value, list) or isinstance(value, object):
15741577
try:
15751578
value = json.dumps(value)
1576-
except:
1577-
pass
1579+
except Exception as e:
1580+
self.logger.info(f"[WARNING] Error in JSON dumping (cache contains): {e}")
15781581
elif not isinstance(value, str):
15791582
value = str(value)
15801583

@@ -1767,8 +1770,8 @@ def set_cache_value(self, key, value):
17671770
if isinstance(value, dict) or isinstance(value, list) or isinstance(value, object):
17681771
try:
17691772
value = json.dumps(value)
1770-
except:
1771-
pass
1773+
except Exception as e:
1774+
self.logger.info(f"[WARNING] Error in JSON dumping (set cache): {e}")
17721775
elif not isinstance(value, str):
17731776
value = str(value)
17741777

0 commit comments

Comments
 (0)