Skip to content
New issue

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

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

Already on GitHub? # to your account

Show exceptions in an error message box #268

Merged
merged 2 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- Add support to select and load multiple files at once ([#257](https://github.com/cbrnr/mnelab/pull/257) by [Florian Hofer](https://github.com/hofaflo))
- Add drag and drop reordering to sidebar ([#261](https://github.com/cbrnr/mnelab/pull/261) by [Florian Hofer](https://github.com/hofaflo))
- Add support for plotting evoked potentials averaged over channels (Plot -> Evoked comparison...) ([#256](https://github.com/cbrnr/mnelab/pull/256) by [Florian Hofer](https://github.com/hofaflo))
- Add "Details..." button to "Select XDF Stream" dialog ([#266](https://github.com/cbrnr/mnelab/pull/266) by [Florian Hofer](https://github.com/hofaflo))

- Exceptions are now shown in an error message box instead of being silently caught ([#268](https://github.com/cbrnr/mnelab/pull/268) by [Florian Hofer](https://github.com/hofaflo))
- Add "Details" button to "Select XDF Stream" dialog ([#266](https://github.com/cbrnr/mnelab/pull/266) by [Florian Hofer](https://github.com/hofaflo))

### Changed
- Simplify rereferencing workflow ([#258](https://github.com/cbrnr/mnelab/pull/258) by [Florian Hofer](https://github.com/hofaflo))
Expand Down
7 changes: 7 additions & 0 deletions mnelab/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# License: BSD (3-clause)

import multiprocessing as mp
import sys
import traceback
from functools import partial
from pathlib import Path
Expand Down Expand Up @@ -66,6 +67,7 @@ def __init__(self, model):
super().__init__()
self.model = model # data model
self.setWindowTitle("MNELAB")
sys.excepthook = self._excepthook

# restore settings
settings = read_settings()
Expand Down Expand Up @@ -299,6 +301,11 @@ def __init__(self, model):
self.setAcceptDrops(True)
self.data_changed()

def _excepthook(self, type, value, traceback_):
exception_text = str(value)
traceback_text = "".join(traceback.format_exception(type, value, traceback_))
ErrorMessageBox(self, exception_text, "", traceback_text).show()

def _sidebar_edit_event(self, edit):
"""
Triggered when a data set in the sidebar is renamed.
Expand Down