Make sure we log failures in `ensure` block.

This commit is contained in:
Guo Xiang Tan 2016-07-15 11:36:47 +08:00
parent 4aa3442824
commit b981041f6f
1 changed files with 8 additions and 2 deletions

View File

@ -52,12 +52,18 @@ module BackupRestore
rescue Exception => ex
log "EXCEPTION: " + ex.message
log ex.backtrace.join("\n")
@success = false
else
@success = true
"#{@archive_basename}.tar.gz"
ensure
notify_user rescue nil
remove_old rescue nil
begin
notify_user
remove_old
rescue => ex
Rails.logger.error("#{ex}\n" + ex.backtrace.join("\n"))
end
clean_up
@success ? log("[SUCCESS]") : log("[FAILED]")
end