From d4d86e3d752a24c85fdd4a1b9cba373d1e3e174d Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Tue, 2 Apr 2019 21:58:41 +0200
Subject: [PATCH] Improve logging and exception message

---
 src/imcflibs/imagej/bioformats.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/imcflibs/imagej/bioformats.py b/src/imcflibs/imagej/bioformats.py
index b5e8220..b44850b 100644
--- a/src/imcflibs/imagej/bioformats.py
+++ b/src/imcflibs/imagej/bioformats.py
@@ -55,6 +55,7 @@ def import_image(filename,
     options.setId(filename)
     log.info("Reading [%s]", filename)
     orig_imps = BF.openImagePlus(options)
+    log.debug("Opened [%s] %s", filename, type(orig_imps))
     return orig_imps
 
 
@@ -78,7 +79,7 @@ def export(imp, filename, overwrite=False):
         log.debug("Detected calibration unit: %s", unit)
     except Exception as err:
         log.error("Unable to detect spatial unit: %s", err)
-        raise RuntimeError("Error detecting image calibration!")
+        raise RuntimeError("Error detecting image calibration: %s" % err)
     if unit == 'pixel' and (suffix == 'ics' or suffix == 'ids'):
         log.warn("Forcing unit to be 'm' instead of 'pixel' to avoid "
                  "Bio-Formats 6.0.x Exporter bug!")
-- 
GitLab