Skip to content
Snippets Groups Projects
Commit 0a3c7dc4 authored by B13nch3n's avatar B13nch3n
Browse files

Change error handling

parent 5646680c
No related branches found
No related tags found
No related merge requests found
\.DS_Store
......@@ -423,16 +423,16 @@ class _CifCheck:
universal_newlines=True,
cwd=cifcheck_wd,
)
error_lst = []
# get error messages on the command line
filename = os.path.basename(filepath)
if cps.returncode != 0:
error_lst = _parse_cifcheck_stderr(cps.stderr)
error_lst.extend(_parse_parser_file(filename))
error_lst.extend(_parse_cifcheck_stderr(cps.stderr))
error_lst.extend(_parse_parser_file(filepath))
if len(error_lst) > 0:
raise _CifCheckFailedError(cifcheck_cmd, error_lst)
# get messages from diagnosis file
error_lst.extend(_parse_diag_file(os.path.join(cifcheck_wd, filename)))
error_lst.extend(_parse_diag_file(filepath))
return error_lst
......@@ -625,12 +625,6 @@ def _main():
cifcheck.make_json_output()
sys.exit(1)
# do a first check of the model cif alone to make sure its actual cif
success = cifcheck.run(opts.model_cif)
if not success:
cifcheck.make_json_output()
sys.exit(1)
# check for associated files referenced by the model cif file
assoc_files, model_cif_data, entry_id_map = _get_associated_files(
opts.model_cif
......@@ -641,12 +635,6 @@ def _main():
# make sure associated files exist and merge all of them into the model
for assoc, entry_id in assoc_files:
assoc_path = os.path.join(opts.associates_dir, assoc)
# CifCheck the file to make sure its actually cif, diagnosis messages do
# not matter at this point as an incomplete file is tested.
success = cifcheck.run(assoc_path)
if not success:
cifcheck.make_json_output()
sys.exit(1)
# merge the model.cif and the associated file
msgs = _merge_cif_data(
model_cif_data, assoc_path, entry_id, entry_id_map
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment