diff options
author | Peter Kozak <spag@golwen.net> | 2013-07-01 12:55:15 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-07-01 12:55:15 +0200 |
commit | 790253f927872e79e562b44575be529f573ad0ef (patch) | |
tree | eb791e4e6b077b4c75c170440dc5000df984f6bf | |
parent | 7a42f972e8790b04754be6e636e1028fc3d5d70f (diff) |
exception handling
-rw-r--r-- | app/controllers/trigger_controller.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb index 3dbb2a5..290a1fc 100644 --- a/app/controllers/trigger_controller.rb +++ b/app/controllers/trigger_controller.rb @@ -135,8 +135,18 @@ class TriggerController < ApplicationController working_path, tiff_file = File.split(fax_document.tiff) if fax_document.store_dir != working_path - FileUtils.mkdir(fax_document.store_dir) - FileUtils.mv(fax_document.tiff, fax_document.store_dir) + begin + FileUtils.mkdir(fax_document.store_dir) + rescue => e + logger.error "PDF fax directory not created: #{fax_document.store_dir} => #{e.inspect}" + end + + begin + FileUtils.mv(fax_document.tiff, fax_document.store_dir) + rescue => e + logger.error "PDF fax files not moved: #{fax_document.tiff} => #{e.inspect}" + end + fax_document.tiff = "#{fax_document.store_dir}/#{tiff_file}" end |