From 53a98b21f031b429f14a9cd9ec2feeb040a633db Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 29 Jan 2013 09:32:39 +0100 Subject: log file access errors --- app/controllers/trigger_controller.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/controllers/trigger_controller.rb') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index ac43832..2b491be 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -97,8 +97,16 @@ class TriggerController < ApplicationController if fax_document.save Notifications.new_fax(fax_document).deliver - File.delete("#{TMP_DIR}#{tiff_file}"); - File.delete(pdf_file); + begin + File.delete("#{TMP_DIR}#{tiff_file}"); + rescue => e + logger.error "Raw fax file could not be deleted: #{TMP_DIR}#{tiff_file} => #{e.inspect}" + end + begin + File.delete(pdf_file); + rescue => e + logger.error "PDF fax file could not be deleted: #{TMP_DIR}#{pdf_file} => #{e.inspect}" + end fax_document.tiff = nil fax_document.save fax_document.render_thumbnails -- cgit v1.2.3