Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Print longer traceback on report error #892

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MAINT: Print longer traceback on report error
larsoner committed Mar 19, 2024
commit de8895d272ae10f77b8bc4456251513c65aca5e2
7 changes: 5 additions & 2 deletions mne_bids_pipeline/_report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import contextlib
import re
import traceback
from functools import lru_cache
from io import StringIO
from textwrap import indent
from types import SimpleNamespace
from typing import Literal, Optional

@@ -67,8 +69,9 @@ def _open_report(
report = mne.open_report(fname_report)
except Exception as exc:
raise exc.__class__(
f"Could not open {name} HDF5 file:\n{fname_report}\n"
f"Got error:\n{exc}\nPerhaps you need to delete it?"
f"Could not open {name} HDF5 file:\n{fname_report}, "
"Perhaps you need to delete it? Got error:\n\n"
f'{indent(traceback.format_exc(), " ")}'
) from None
try:
yield report