mirror of
https://github.com/nishiki/manage-password.git
synced 2025-03-20 21:34:35 +00:00
fix syntax for all rescue
This commit is contained in:
parent
b0905f18f1
commit
2de66a4eaf
3 changed files with 21 additions and 21 deletions
|
@ -38,7 +38,7 @@ module MPW
|
||||||
@config.setup(options)
|
@config.setup(options)
|
||||||
|
|
||||||
puts I18n.t('form.set_config.valid').to_s.green
|
puts I18n.t('form.set_config.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ module MPW
|
||||||
@config.set_wallet_path(path, @wallet)
|
@config.set_wallet_path(path, @wallet)
|
||||||
|
|
||||||
puts I18n.t('form.set_wallet_path.valid').to_s.green
|
puts I18n.t('form.set_wallet_path.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #19: #{e}".red
|
puts "#{I18n.t('display.error')} #19: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -66,7 +66,7 @@ module MPW
|
||||||
load_config
|
load_config
|
||||||
|
|
||||||
puts I18n.t('form.setup_config.valid').to_s.green
|
puts I18n.t('form.setup_config.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -88,7 +88,7 @@ module MPW
|
||||||
@config.setup_gpg_key(@password, gpg_key)
|
@config.setup_gpg_key(@password, gpg_key)
|
||||||
|
|
||||||
puts I18n.t('form.setup_gpg_key.valid').to_s.green
|
puts I18n.t('form.setup_gpg_key.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -118,7 +118,7 @@ module MPW
|
||||||
# Load config
|
# Load config
|
||||||
def load_config
|
def load_config
|
||||||
@config.load_config
|
@config.load_config
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #10: #{e}".red
|
puts "#{I18n.t('display.error')} #10: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -139,7 +139,7 @@ module MPW
|
||||||
@mpw.read_data
|
@mpw.read_data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #11: #{e}".red
|
puts "#{I18n.t('display.error')} #11: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
end
|
end
|
||||||
|
@ -416,7 +416,7 @@ module MPW
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts I18n.t('form.add_key.valid').to_s.green
|
puts I18n.t('form.add_key.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ module MPW
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts I18n.t('form.delete_key.valid').to_s.green
|
puts I18n.t('form.delete_key.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ module MPW
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts I18n.t('form.add_item.valid').to_s.green
|
puts I18n.t('form.add_item.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ module MPW
|
||||||
|
|
||||||
puts I18n.t('form.update_item.valid').to_s.green
|
puts I18n.t('form.update_item.valid').to_s.green
|
||||||
end
|
end
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #14: #{e}".red
|
puts "#{I18n.t('display.error')} #14: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -530,7 +530,7 @@ module MPW
|
||||||
|
|
||||||
puts I18n.t('form.delete_item.valid').to_s.green
|
puts I18n.t('form.delete_item.valid').to_s.green
|
||||||
end
|
end
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #16: #{e}".red
|
puts "#{I18n.t('display.error')} #16: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ module MPW
|
||||||
item = get_item(items)
|
item = get_item(items)
|
||||||
clipboard(item, clipboard)
|
clipboard(item, clipboard)
|
||||||
end
|
end
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #14: #{e}".red
|
puts "#{I18n.t('display.error')} #14: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ module MPW
|
||||||
File.open(file, 'w') { |f| f << data.to_yaml }
|
File.open(file, 'w') { |f| f << data.to_yaml }
|
||||||
|
|
||||||
puts I18n.t('form.export.valid', file: file).to_s.green
|
puts I18n.t('form.export.valid', file: file).to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #17: #{e}".red
|
puts "#{I18n.t('display.error')} #17: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ module MPW
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts I18n.t('form.import.valid').to_s.green
|
puts I18n.t('form.import.valid').to_s.green
|
||||||
rescue e
|
rescue => e
|
||||||
puts "#{I18n.t('display.error')} #18: #{e}".red
|
puts "#{I18n.t('display.error')} #18: #{e}".red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,7 +93,7 @@ module MPW
|
||||||
File.open(@config_file, 'w') do |file|
|
File.open(@config_file, 'w') do |file|
|
||||||
file << config.to_yaml
|
file << config.to_yaml
|
||||||
end
|
end
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.config.write')}\n#{e}"
|
raise "#{I18n.t('error.config.write')}\n#{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ module MPW
|
||||||
|
|
||||||
ctx = GPGME::Ctx.new
|
ctx = GPGME::Ctx.new
|
||||||
ctx.genkey(param, nil, nil)
|
ctx.genkey(param, nil, nil)
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.config.genkey_gpg.exception')}\n#{e}"
|
raise "#{I18n.t('error.config.genkey_gpg.exception')}\n#{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ module MPW
|
||||||
raise if @gpg_key.empty? || @wallet_dir.empty?
|
raise if @gpg_key.empty? || @wallet_dir.empty?
|
||||||
|
|
||||||
I18n.locale = @lang.to_sym
|
I18n.locale = @lang.to_sym
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.config.load')}\n#{e}"
|
raise "#{I18n.t('error.config.load')}\n#{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
add_key(@key) unless @keys.key?(@key)
|
add_key(@key) unless @keys.key?(@key)
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.mpw_file.read_data')}\n#{e}"
|
raise "#{I18n.t('error.mpw_file.read_data')}\n#{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
File.rename(tmp_file, @wallet_file)
|
File.rename(tmp_file, @wallet_file)
|
||||||
rescue e
|
rescue => e
|
||||||
File.unlink(tmp_file) if File.exist?(tmp_file)
|
File.unlink(tmp_file) if File.exist?(tmp_file)
|
||||||
|
|
||||||
raise "#{I18n.t('error.mpw_file.write_data')}\n#{e}"
|
raise "#{I18n.t('error.mpw_file.write_data')}\n#{e}"
|
||||||
|
@ -323,7 +323,7 @@ module MPW
|
||||||
crypto
|
crypto
|
||||||
.decrypt(data, password)
|
.decrypt(data, password)
|
||||||
.read.force_encoding('utf-8')
|
.read.force_encoding('utf-8')
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.gpg_file.decrypt')}\n#{e}"
|
raise "#{I18n.t('error.gpg_file.decrypt')}\n#{e}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ module MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
crypto.encrypt(data, recipients: recipients).read
|
crypto.encrypt(data, recipients: recipients).read
|
||||||
rescue e
|
rescue => e
|
||||||
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
|
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue