aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-cli/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-cli/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java9
1 files changed, 7 insertions, 2 deletions
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);
}