From e39e422069448331fc2896949b7fa08ebc697333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=B6ter?= Date: Tue, 17 Sep 2024 22:01:01 +0200 Subject: [PATCH] Unify exception handling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generalize to catch all exceptions and condense exception handling code and error messages. Co-authored-by: Melissa Linkert Co-authored-by: Sébastien Besson --- .../src/loci/formats/tools/ImageInfo.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java b/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java index bab4de127fa..9a2e93f564b 100644 --- a/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java +++ b/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java @@ -1146,18 +1146,8 @@ public static void main(String[] args) throws Exception { try { new ImageInfo().testRead(newArgs); } - catch (FormatException e) { - LOGGER.error("Caught FormatException. " + e.getMessage()); - exitCode = 1; - continue; - } - catch (IOException e) { - LOGGER.error("Caught IOException. " + e.getMessage()); - exitCode = 1; - continue; - } - catch (ServiceException e) { - LOGGER.error("Caught ServiceException. " + e.getMessage()); + catch (Exception e) { + LOGGER.error("Caught " + e.getClass().getSimpleName(), e); exitCode = 1; continue; }