diff --git a/src/imcflibs/imagej/misc.py b/src/imcflibs/imagej/misc.py index e8fff0b3ca0c43a6149a8dc4f16955c787df8f73..2d0e33e3ab23dbbc6128d7faa5f3040e03f5491f 100644 --- a/src/imcflibs/imagej/misc.py +++ b/src/imcflibs/imagej/misc.py @@ -1,9 +1,11 @@ """Miscellaneous ImageJ related functions, mostly convenience wrappers.""" +import sys from ij import IJ # pylint: disable-msg=E0401 from ..log import LOG as log + def show_status(msg): """Wrapper to update the ImageJ status bar and the log simultaneously.""" log.info(msg) @@ -15,3 +17,8 @@ def show_progress(cur, final): # ij.IJ.showProgress is adding 1 to the value given as first parameter... log.info("Progress: %s / %s (%s)", cur+1, final, (1.0+cur)/final) IJ.showProgress(cur, final) + +def error_exit(msg): + """Convenience wrapper to log an error and exit then.""" + log.error(msg) + sys.exit(msg)