Method: Docman::Application#with_rescue
- Defined in:
- lib/application.rb
#with_rescue(write_to_file = true) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/application.rb', line 62 def with_rescue(write_to_file = true) 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' if write_to_file File.open(failed_filepath, 'w') {|f| f.write(e.) } end raise e end |