Skip to content

Commit 2bc824e

Browse files
stephprincerly
andauthored
Update inspector report summary for PyNWB read errors (#603)
* update read error message * update CHANGELOG --------- Co-authored-by: Ryan Ly <[email protected]>
1 parent 0089579 commit 2bc824e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Fixed issue where the io object remained open after inspection was completed. [#601](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/601)
1111

1212
### Improvements
13+
* Updated InspectorMessage reporting for PyNWB read errors to improve readability [#603](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/603)
1314
* Added support for PyNWB 3.1 and NWB Schema 2.9 [#602](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/602)
1415

1516
# v0.6.3 (March 13, 2025)

src/nwbinspector/_nwb_inspection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,7 @@ def inspect_all(
148148
nwbfile = read_nwbfile(nwbfile_path=nwbfile_path)
149149
identifiers[nwbfile.identifier].append(nwbfile_path)
150150
except Exception as exception:
151-
yield InspectorMessage(
152-
message=traceback.format_exc(),
153-
importance=Importance.ERROR,
154-
check_function_name=f"During io.read() - {type(exception)}: {str(exception)}",
155-
file_path=str(nwbfile_path),
156-
)
151+
continue # read failure errors will be returned as part of inspect_nwbfile
157152

158153
if len(identifiers) != len(nwbfiles):
159154
for identifier, nwbfiles_with_identifier in identifiers.items():
@@ -304,10 +299,15 @@ def inspect_nwbfile(
304299
inspector_message.file_path = nwbfile_path # type: ignore
305300
yield inspector_message
306301
except Exception as exception:
302+
exception_name = f"{type(exception).__module__}.{type(exception).__name__}"
307303
yield InspectorMessage(
308304
message=traceback.format_exc(),
309305
importance=Importance.ERROR,
310-
check_function_name=f"During io.read() - {type(exception)}: {str(exception)}",
306+
check_function_name=(
307+
f"During io.read(), an error occurred: {exception_name}. "
308+
f"This indicates that PyNWB was unable to read the file. "
309+
f"See the traceback message for more details."
310+
),
311311
file_path=nwbfile_path,
312312
)
313313
finally:

0 commit comments

Comments
 (0)