Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-client
Commits
b347ddb0
Commit
b347ddb0
authored
Jan 07, 2026
by
Wei Shoulin
Browse files
feat(plan): add error handling for JSON format validation
parent
7a504935
Pipeline
#11728
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_dfs_client/plan.py
View file @
b347ddb0
...
...
@@ -121,7 +121,12 @@ def write_file(local_file: Union[IO, str, list]) -> Result:
Result: 操作的结果对象,包含操作是否成功以及相关的错误信息,成功返回数据对象。
"""
data
=
load_file
(
local_file
)
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
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment