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: Don't overwrite attachment if the burst fails
Date Mon, 22 Oct 2018 01:16:57 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 efcb7fb  Don't overwrite attachment if the burst fails
efcb7fb is described below

commit efcb7fbc8a8872435981ea049ab35a980a4093e6
Author: Sebb <sebb@apache.org>
AuthorDate: Mon Oct 22 02:16:55 2018 +0100

    Don't overwrite attachment if the burst fails
    
    Also report path name when an error occurs
---
 www/secretary/workbench/views/actions/burst.json.rb | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/secretary/workbench/views/actions/burst.json.rb b/www/secretary/workbench/views/actions/burst.json.rb
index 802adeb..c0065f9 100644
--- a/www/secretary/workbench/views/actions/burst.json.rb
+++ b/www/secretary/workbench/views/actions/burst.json.rb
@@ -23,12 +23,15 @@ begin
         name: format % (index+1),
         content: File.read(page),
         mime: 'application/pdf'
-      }
+      } if File.size? page # skip empty output files
     end
   end
 
-  message.replace_attachment @selected, attachments
-
+  # Don't replace if no output was produced
+  message.replace_attachment @selected, attachments unless attachments.empty?
+rescue
+  Wunderbar.error "Cannot process #{@selected}"
+  raise
 ensure
   source.unlink if source
 end


Mime
View raw message