summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mail/mailer.vala12
-rw-r--r--src/pdf-invoice/test.vala24
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;
}