whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Store message even if parsing fails
Date Thu, 03 May 2018 14:31:20 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new e9085b4  Store message even if parsing fails
e9085b4 is described below

commit e9085b4b05ef893516acdaa5396d63bbf8cff109
Author: Sebb <sebb@apache.org>
AuthorDate: Thu May 3 15:31:19 2018 +0100

    Store message even if parsing fails
---
 www/secretary/workbench/deliver.rb | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/www/secretary/workbench/deliver.rb b/www/secretary/workbench/deliver.rb
index 632b361..cb4396c 100644
--- a/www/secretary/workbench/deliver.rb
+++ b/www/secretary/workbench/deliver.rb
@@ -10,7 +10,18 @@ require_relative 'models/mailbox'
 STDIN.binmode
 email = STDIN.read
 hash = Message.hash(email)
-headers = Message.parse(email)
+
+fail = nil
+begin
+  headers = Message.parse(email)
+rescue => e
+  fail = e
+  headers = {
+    exception: e.to_s,
+    backtrace: e.backtrace[0],
+    message: 'See procmail.log for full details'
+  }
+end
 
 # construct message
 month = (Time.parse(headers[:time]) rescue Time.now).strftime('%Y%m')
@@ -21,3 +32,6 @@ message = Message.new(mailbox, hash, headers, email)
 File.umask(0002)
 message.write_headers
 message.write_email
+
+# Now fail if there was an error
+raise fail if fail
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
sebb@apache.org.

Mime
View raw message