From b90d91c7a6f46fa60d32c43a82c3deaaf045dfd4 Mon Sep 17 00:00:00 2001 From: Fernando Barreiro Date: Mon, 9 Dec 2024 12:02:16 +0100 Subject: [PATCH] Exception handling for JSON decoding errors --- pandaserver/taskbuffer/OraDBProxy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandaserver/taskbuffer/OraDBProxy.py b/pandaserver/taskbuffer/OraDBProxy.py index a1f3c9fe..15758355 100644 --- a/pandaserver/taskbuffer/OraDBProxy.py +++ b/pandaserver/taskbuffer/OraDBProxy.py @@ -19,6 +19,7 @@ import traceback import uuid import warnings +from json.decoder import JSONDecodeError from pandacommon.pandalogger.LogWrapper import LogWrapper from pandacommon.pandalogger.PandaLogger import PandaLogger @@ -457,9 +458,11 @@ def getConfigValue(self, component, key, app="pandaserver", vo=None): return json.loads(value_json_str) else: raise ValueError + except JSONDecodeError: + _logger.debug(f"Could not decode. Value_json: {value_json_str}, Type: {type}") + return None except ValueError: - error_message = f"Wrong value/type pair. Value: {value_str}, Type: {type}" - _logger.debug(error_message) + _logger.debug(f"Wrong value/type pair. Value: {value_str}, Type: {type}") return None # insert job to jobsDefined