summaryrefslogtreecommitdiffstats
path: root/src/pdf-invoice/test.vala
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
committerHolger Cremer <HolgerCremer@gmail.com>2018-08-27 19:38:11 +0200
commit8f2ba2050ee78d0e4a47f1277c6bc4422d06170c (patch)
treec008d2878905e03df7a8bf8bd3330762cc2d8f43 /src/pdf-invoice/test.vala
parentbb55e121576a5b5d225bfc68c5062f386cc32db9 (diff)
parent3fc3ea6c6df237dbdf48d14703118b747bf5d647 (diff)
downloadserial-barcode-scanner-8f2ba2050ee78d0e4a47f1277c6bc4422d06170c.tar.bz2
Merge branch 'master' into better_inventory
Conflicts: README data/templates/products/entry.html docker/Dockerfile docker/init.sh src/database/database.vala src/database/db-interface.vala src/pdf-stock/Makefile src/pdf-stock/pdf-stock-interface.vala src/pdf-stock/pdf-stock.vala src/web/Makefile src/web/main.vala templates/menu.html templates/products/index.html
Diffstat (limited to 'src/pdf-invoice/test.vala')
-rw-r--r--src/pdf-invoice/test.vala24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/pdf-invoice/test.vala b/src/pdf-invoice/test.vala
index e55f3a3..5eb7f52 100644
--- a/src/pdf-invoice/test.vala
+++ b/src/pdf-invoice/test.vala
@@ -14,7 +14,13 @@
*/
public static int main(string args[]) {
- PDFInvoice invoice = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.InvoicePDF", "/io/mainframe/shopsystem/invoicepdf");
+ PDFInvoice invoice;
+
+ try {
+ invoice = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.InvoicePDF", "/io/mainframe/shopsystem/invoicepdf");
+ } catch(IOError e) {
+ error(_("IO Error: %s\n"), e.message);
+ }
InvoiceRecipient r = {
"Max",
@@ -43,10 +49,20 @@ public static int main(string args[]) {
invoice.invoice_entries = {e1};
/* generate pdf */
- var pdfdata = invoice.generate();
+ try {
+ var pdfdata = invoice.generate();
- /* write pdf into file */
- FileUtils.set_contents("test.pdf", (string) pdfdata, pdfdata.length);
+ /* write pdf into file */
+ FileUtils.set_contents("test.pdf", (string) pdfdata, pdfdata.length);
+ } catch(DBusError e) {
+ error(_("DBus Error: %s\n"), e.message);
+ } catch(IOError e) {
+ error(_("IO Error: %s\n"), e.message);
+ } catch(InvoicePDFError e) {
+ error(_("Invoice PDF Error: %s\n"), e.message);
+ } catch(FileError e) {
+ error(_("File Error: %s\n"), e.message);
+ }
return 0;
}