Method: Docman::Application#with_rescue

Defined in:
lib/application.rb

#with_rescueObject



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/application.rb', line 55

def with_rescue
  failed_filepath = File.join(@workspace_dir, 'failed')
  if File.file?(failed_filepath)
    log 'Last operation failed, forced rebuild mode'
    FileUtils.rm_f failed_filepath
    @force = true
  end
  yield
rescue Exception => e
  log "Operation failed: #{e.message}", 'error'
  File.open(failed_filepath, 'w') {|f| f.write('Failed!') }
  raise e
end