aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Reinier van der Leer <pwuts@agpt.co> 2024-04-24 18:57:50 +0200
committerGravatar Reinier van der Leer <pwuts@agpt.co> 2024-04-24 18:57:50 +0200
commit6add6455977c72ca0aefb489a29fd63b6628720a (patch)
tree5cf754b3d2757cadfd39caefe9f7880e37d087fd
parentfix(agent): Omit `EventHistory` progress message if empty (diff)
downloadAuto-GPT-6add6455977c72ca0aefb489a29fd63b6628720a.tar.gz
Auto-GPT-6add6455977c72ca0aefb489a29fd63b6628720a.tar.bz2
Auto-GPT-6add6455977c72ca0aefb489a29fd63b6628720a.zip
fix(agent): Expand failure check in `json_loads(..)`
Not only check if the resulting object is `demjson3.undefined`, but also `demjson3.syntax_error`.
-rw-r--r--autogpts/autogpt/autogpt/core/utils/json_utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/autogpts/autogpt/autogpt/core/utils/json_utils.py b/autogpts/autogpt/autogpt/core/utils/json_utils.py
index 0374a85c1..45650427d 100644
--- a/autogpts/autogpt/autogpt/core/utils/json_utils.py
+++ b/autogpts/autogpt/autogpt/core/utils/json_utils.py
@@ -39,7 +39,7 @@ def json_loads(json_str: str) -> Any:
"JSON parse errors:\n" + "\n".join(str(e) for e in json_result.errors)
)
- if json_result.object is demjson3.undefined:
+ if json_result.object in (demjson3.syntax_error, demjson3.undefined):
raise ValueError(
f"Failed to parse JSON string: {json_str}", *json_result.errors
)