diff options
author | Sebastian Reichel <sre@ring0.de> | 2018-07-01 17:22:56 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2018-07-15 22:59:57 +0200 |
commit | e821aca14ee3c59380c82e32c9cfcdbcca144a96 (patch) | |
tree | 7c9f36a5049590395cce6e0c6721f43faf99dab2 /src | |
parent | 98dda4beafd082b96c6dc8b3f44e1589a39069c1 (diff) | |
download | serial-barcode-scanner-e821aca14ee3c59380c82e32c9cfcdbcca144a96.tar.bz2 |
all: fix all remaining warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/mail/mailer.vala | 12 | ||||
-rw-r--r-- | src/pdf-invoice/test.vala | 24 |
2 files changed, 28 insertions, 8 deletions
diff --git a/src/mail/mailer.vala b/src/mail/mailer.vala index 3d7a996..642ceaa 100644 --- a/src/mail/mailer.vala +++ b/src/mail/mailer.vala @@ -172,12 +172,16 @@ public class MailerImplementation { message.set_reverse_path(current_mail.get_reverse_path()); int result = session.start_session(); - if(result == 0) - throw new IOError.FAILED(_("eSMTP: Start Session failed!")); + if(result == 0) { + stderr.printf(_("eSMTP: Start Session failed!")); + return false; + } unowned Smtp.Status status = message.transfer_status(); - if(status.code < 200 || status.code >= 300) - throw new IOError.FAILED(_("Reply from SMTP-Server: %s"), status.text); + if(status.code < 200 || status.code >= 300) { + stderr.printf(_("Reply from SMTP-Server: %s")); + return false; + } current_mail = null; 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; } |