Skip to content

Commit 0b4b6ba

Browse files
ISMAILI AdamISMAILI Adam
authored andcommitted
errors replaced by warnings
1 parent 82fcc0b commit 0b4b6ba

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

clinica/converters/genfi_to_bids/_utils.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pydicom as pdcm
88
from fsspec.implementations.local import LocalFileSystem
99

10-
from clinica.utils.stream import cprint
10+
from clinica.utils.stream import cprint, log_and_warn
1111

1212
__all__ = [
1313
"merge_imaging_and_clinical_data",
@@ -316,14 +316,18 @@ def _load_clinical_data_list(cdt_path: Path, specs_df: pd.DataFrame) -> List[str
316316
continue # Skip empty lines
317317

318318
if data not in specs_values:
319-
raise ValueError(
320-
f"Error at line {i}: '{data}' not found in specifications."
319+
log_and_warn(
320+
f"Line {i}: '{data}' not found in specifications. It will be ignored.",
321+
UserWarning,
321322
)
323+
continue
322324

323325
clinical_data_list.append(data)
324326

325327
if not clinical_data_list:
326-
raise ValueError("'-clinical_data_txt/cdt' is empty (no valid entries found).")
328+
log_and_warn(
329+
"'-clinical_data_txt/cdt' is empty (no valid entries found).", UserWarning
330+
)
327331

328332
return clinical_data_list
329333

@@ -414,12 +418,10 @@ def prepare_dataset_to_bids_format(
414418

415419
if path_to_clinical_txt:
416420
if full:
417-
cprint(
418-
msg=(
419-
"The '-full' flag is being used, "
420-
"using the '-clinical_data_txt/-cdt' option is redundant and will be ignored."
421-
),
422-
lvl="warning",
421+
log_and_warn(
422+
"The '-full' flag is being used, "
423+
"using the '-clinical_data_txt/-cdt' option is redundant and will be ignored.",
424+
UserWarning,
423425
)
424426

425427
else:

0 commit comments

Comments
 (0)