fix error message when sync

This commit is contained in:
nishiki 2014-03-16 14:44:26 +01:00
parent 684972e440
commit ea9b2fb411

View file

@ -48,22 +48,26 @@ class Cli
if @sync.enable if @sync.enable
if !@mpw.sync(@sync.get(@passwd), @config.last_update) if !@mpw.sync(@sync.get(@passwd), @config.last_update)
puts "#{I18n.t('display.error')}: #{@sync.error_msg}" puts "#{I18n.t('display.error')}: #{@mpw.error_msg}" if !@mpw.error_msg.nil?
puts "#{I18n.t('display.error')}: #{@sync.error_msg}" if !@sync.error_msg.nil?
return false
end end
if !@sync.update(File.open(@config.file_gpg).read) if !@sync.update(File.open(@config.file_gpg).read)
puts "#{I18n.t('display.error')}: #{@sync.error_msg}" puts "#{I18n.t('display.error')}: #{@sync.error_msg}"
elsif !@config.set_last_update elsif !@config.set_last_update
puts "#{I18n.t('display.error')}: #{@config.error_msg}" puts "#{I18n.t('display.error')}: #{@config.error_msg}"
elsif !@mpw.encrypt
puts "#{I18n.t('display.error')}: #{@mpw.error_msg}"
else else
return true return true
end end
end end
rescue Exception => e rescue Exception => e
puts "#{I18n.t('display.error')}: #{e}" puts "#{I18n.t('display.error')}: #{e}"
puts @sync.error_msg puts @sync.error_msg if @sync.error_msg.nil?
puts @config.error_msg puts @config.error_msg if @config.error_msg.nil?
puts @mpw.error_msg puts @mpw.error_msg if @mpw.error_msg.nil?
else else
return false return false
end end