mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 11:06:00 +08:00
fix: improve JSON parsing error handling in Executor class (#12265)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
parent
62f792ea14
commit
c7911c7130
@ -158,7 +158,10 @@ class Executor:
|
|||||||
if len(data) != 1:
|
if len(data) != 1:
|
||||||
raise RequestBodyError("json body type should have exactly one item")
|
raise RequestBodyError("json body type should have exactly one item")
|
||||||
json_string = self.variable_pool.convert_template(data[0].value).text
|
json_string = self.variable_pool.convert_template(data[0].value).text
|
||||||
json_object = json.loads(json_string, strict=False)
|
try:
|
||||||
|
json_object = json.loads(json_string, strict=False)
|
||||||
|
except json.JSONDecodeError as e:
|
||||||
|
raise RequestBodyError(f"Failed to parse JSON: {json_string}") from e
|
||||||
self.json = json_object
|
self.json = json_object
|
||||||
# self.json = self._parse_object_contains_variables(json_object)
|
# self.json = self._parse_object_contains_variables(json_object)
|
||||||
case "binary":
|
case "binary":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user