From f60ba3d6a0c0776d1f7b97d02b9d1608a5788a0e Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Fri, 2 Sep 2022 15:26:11 -0500 Subject: [PATCH] improve error handling --- element_array_ephys/readers/kilosort_triggering.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/element_array_ephys/readers/kilosort_triggering.py b/element_array_ephys/readers/kilosort_triggering.py index 3645dc1a..4bdd1fed 100644 --- a/element_array_ephys/readers/kilosort_triggering.py +++ b/element_array_ephys/readers/kilosort_triggering.py @@ -239,9 +239,11 @@ def _get_raw_data_filepaths(self): data_directory = catGT_dest / run_folder / prb_folder else: data_directory = self._npx_input_dir - - meta_fp = next(data_directory.glob(f'{session_str}*.ap.meta')) - bin_fp = next(data_directory.glob(f'{session_str}*.ap.bin')) + try: + meta_fp = next(data_directory.glob(f'{session_str}*.ap.meta')) + bin_fp = next(data_directory.glob(f'{session_str}*.ap.bin')) + except StopIteration: + raise RuntimeError(f'No ap meta/bin files found in {data_directory} - CatGT error?') return meta_fp, bin_fp