Skip to content

Commit

Permalink
Notify the user of global exceptions during import through the GUI
Browse files Browse the repository at this point in the history
The GUI has simply notified the user when the import could not be completed but has not provided explanations for the import error. Catch global exceptions during import to notify the user of the error and point them to the log file. This notification contains the basic error, while the full stack trace is posted to the console and log file. This notification has not been added to import through the command-line since presumably the error message would be visible in the console.
  • Loading branch information
yoda-vid committed Nov 3, 2021
1 parent d4e49f3 commit 6ba2c24
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions magmap/gui/import_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from magmap.io import importer
from magmap.settings import config

_logger = config.logger.getChild(__name__)


class SetupImportThread(QtCore.QThread):
"""Thread for setting up file import by extracting image metadata.
Expand Down Expand Up @@ -81,6 +83,14 @@ def run(self):
img5d = importer.import_multiplane_images(
self.chl_paths, self.prefix, self.import_md, config.series,
fn_feedback=self.fn_feedback)

except Exception as e:
# provide feedback for any errors during import
self.fn_feedback(f"Error during import:\n{e}")
if config.log_path:
self.fn_feedback(f"See log for more info: {config.log_path}\n")
_logger.exception(e)

finally:
if img5d is not None:
# set up the image for immediate use within MagellanMapper
Expand Down

0 comments on commit 6ba2c24

Please sign in to comment.