lib/dbox/syncer.rb in dbox-0.6.4 vs lib/dbox/syncer.rb in dbox-0.6.5

- old
+ new

@@ -206,11 +206,11 @@ changelist[:created] << c[:path] if res.kind_of?(Array) && res[0] == :conflict changelist[:conflicts] ||= [] changelist[:conflicts] << res[1] end - rescue Dbox::ServerError => e + rescue Exception => e log.error "Error while downloading #{c[:path]}: #{e.inspect}" parent_ids_of_failed_entries << c[:parent_id] changelist[:failed] << { :operation => :create, :path => c[:path], :error => e } end end @@ -229,11 +229,11 @@ changelist[:updated] << c[:path] if res.kind_of?(Array) && res[0] == :conflict changelist[:conflicts] ||= [] changelist[:conflicts] << res[1] end - rescue Dbox::ServerError => e + rescue Exception => e log.error "Error while downloading #{c[:path]}: #{e.inspect}" parent_ids_of_failed_entries << c[:parent_id] changelist[:failed] << { :operation => :create, :path => c[:path], :error => e } end end @@ -318,12 +318,16 @@ end # recursively process new & existing subdirectories in parallel threads = recur_dirs.map do |operation, dir| Thread.new do - clone_api_into_current_thread() - Thread.current[:out] = calculate_changes(dir, operation) + begin + clone_api_into_current_thread() + Thread.current[:out] = calculate_changes(dir, operation) + rescue Exception => e + log.error "Error while caclulating changes #{dir}: #{operation}" + end end end threads.each {|t| t.join; out += t[:out] } out @@ -465,11 +469,11 @@ else log.warn "#{c[:path]} had a conflict and was renamed to #{res[:path]} on the server" changelist[:conflicts] ||= [] changelist[:conflicts] << { :original => c[:path], :renamed => res[:path] } end - rescue Dbox::ServerError => e + rescue Exception => e log.error "Error while uploading #{c[:path]}: #{e.inspect}" changelist[:failed] << { :operation => :create, :path => c[:path], :error => e } end end end @@ -494,11 +498,11 @@ else log.warn "#{c[:path]} had a conflict and was renamed to #{res[:path]} on the server" changelist[:conflicts] ||= [] changelist[:conflicts] << { :original => c[:path], :renamed => res[:path] } end - rescue Dbox::ServerError => e + rescue Exception => e log.error "Error while uploading #{c[:path]}: #{e.inspect}" changelist[:failed] << { :operation => :update, :path => c[:path], :error => e } end end end @@ -515,10 +519,10 @@ rescue Dbox::RemoteMissing # safe to delete even if remote is already gone end database.delete_entry_by_path(c[:path]) changelist[:deleted] << c[:path] - rescue Dbox::ServerError => e + rescue Exception => e log.error "Error while deleting #{c[:path]}: #{e.inspect}" changelist[:failed] << { :operation => :delete, :path => c[:path], :error => e } end end else