Skip to content

Commit 710070f

Browse files
committed
Add imagej.misc.error_exit()
1 parent b65c563 commit 710070f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/imcflibs/imagej/misc.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"""Miscellaneous ImageJ related functions, mostly convenience wrappers."""
22

3+
import sys
34
from ij import IJ # pylint: disable-msg=E0401
45

56
from ..log import LOG as log
67

8+
79
def show_status(msg):
810
"""Wrapper to update the ImageJ status bar and the log simultaneously."""
911
log.info(msg)
@@ -15,3 +17,8 @@ def show_progress(cur, final):
1517
# ij.IJ.showProgress is adding 1 to the value given as first parameter...
1618
log.info("Progress: %s / %s (%s)", cur+1, final, (1.0+cur)/final)
1719
IJ.showProgress(cur, final)
20+
21+
def error_exit(msg):
22+
"""Convenience wrapper to log an error and exit then."""
23+
log.error(msg)
24+
sys.exit(msg)

0 commit comments

Comments
 (0)