From 0b663afa4d0167df1e838e1f37bb5862e8951037 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 15 Oct 2014 18:07:20 +0200 Subject: PDF-AS Errorhandling redesign only PDFASError Exceptions are returned ! --- pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pdf-as-cli/src/main/java/at') diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java index 222fd33a..3ce215c8 100644 --- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java +++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java @@ -41,6 +41,7 @@ import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.io.IOUtils; +import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.common.utils.StreamUtils; import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; import at.gv.egiz.pdfas.lib.api.Configuration; @@ -241,8 +242,12 @@ public class Main { System.err.println("Invalid arguments: " + e.getMessage()); usage(); System.exit(-1); - } catch (Exception e) { - System.err.println("PDF-AS Error: " + e.getMessage()); + } catch (PDFASError e) { + System.err.println("PDF-AS Error: [" + e.getCode() + "]" + e.getMessage()); + e.printStackTrace(System.err); + System.exit(-1); + } catch (Throwable e) { + System.err.println("Unhandled PDF-AS Error: " + e.getMessage()); e.printStackTrace(System.err); System.exit(-1); } -- cgit v1.2.3