Commit b347ddb0 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

feat(plan): add error handling for JSON format validation

parent 7a504935
Pipeline #11728 failed with stages
in 0 seconds
......@@ -121,7 +121,12 @@ def write_file(local_file: Union[IO, str, list]) -> Result:
Result: 操作的结果对象,包含操作是否成功以及相关的错误信息,成功返回数据对象。
"""
data = []
try:
data = load_file(local_file)
except Exception as _:
return Result.error("error json format")
for i in range(0, len(data), WRITE_BATCH_SIZE):
batch_data = data[i:i + WRITE_BATCH_SIZE]
response = request.post("/api/plan/file", {"plans": batch_data})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment