mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-20 01:50:04 +00:00
fix rescue
This commit is contained in:
parent
ac2732d116
commit
002ec2175b
3 changed files with 20 additions and 21 deletions
|
@ -40,7 +40,7 @@ class Cli
|
|||
@config.setup(options)
|
||||
|
||||
puts I18n.t('form.set_config.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||
exit 2
|
||||
end
|
||||
|
@ -57,7 +57,7 @@ class Cli
|
|||
load_config
|
||||
|
||||
puts I18n.t('form.setup_config.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||
exit 2
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ class Cli
|
|||
@config.setup_gpg_key(@password, gpg_key)
|
||||
|
||||
puts I18n.t('form.setup_gpg_key.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||
exit 2
|
||||
end
|
||||
|
@ -94,8 +94,7 @@ class Cli
|
|||
# Load config
|
||||
def load_config
|
||||
@config.load_config
|
||||
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #10: #{e}".red
|
||||
exit 2
|
||||
end
|
||||
|
@ -108,7 +107,7 @@ class Cli
|
|||
end
|
||||
|
||||
@mpw.read_data
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #11: #{e}".red
|
||||
exit 2
|
||||
end
|
||||
|
@ -340,7 +339,7 @@ class Cli
|
|||
@mpw.write_data
|
||||
|
||||
puts I18n.t('form.add_key.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -351,7 +350,7 @@ class Cli
|
|||
@mpw.write_data
|
||||
|
||||
puts I18n.t('form.delete_key.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -400,7 +399,7 @@ class Cli
|
|||
@mpw.write_data
|
||||
|
||||
puts I18n.t('form.add_item.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -426,7 +425,7 @@ class Cli
|
|||
|
||||
puts I18n.t('form.update_item.valid').to_s.green
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #14: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -450,7 +449,7 @@ class Cli
|
|||
|
||||
puts I18n.t('form.delete_item.valid').to_s.green
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #16: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -468,7 +467,7 @@ class Cli
|
|||
item = get_item(items)
|
||||
clipboard(item, clipboard)
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #14: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -500,7 +499,7 @@ class Cli
|
|||
File.open(file, 'w') { |f| f << data.to_yaml }
|
||||
|
||||
puts I18n.t('form.export.valid', file: file).to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #17: #{e}".red
|
||||
end
|
||||
|
||||
|
@ -528,7 +527,7 @@ class Cli
|
|||
@mpw.write_data
|
||||
|
||||
puts I18n.t('form.import.valid').to_s.green
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
puts "#{I18n.t('display.error')} #18: #{e}".red
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,7 +89,7 @@ class Config
|
|||
File.open(@config_file, 'w') do |file|
|
||||
file << config.to_yaml
|
||||
end
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.config.write')}\n#{e}"
|
||||
end
|
||||
|
||||
|
@ -121,7 +121,7 @@ class Config
|
|||
|
||||
ctx = GPGME::Ctx.new
|
||||
ctx.genkey(param, nil, nil)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.config.genkey_gpg.exception')}\n#{e}"
|
||||
end
|
||||
|
||||
|
@ -138,7 +138,7 @@ class Config
|
|||
raise if @gpg_key.empty? || @wallet_dir.empty?
|
||||
|
||||
I18n.locale = @lang.to_sym
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.config.load')}\n#{e}"
|
||||
end
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class MPW
|
|||
end
|
||||
|
||||
add_key(@key) if @keys[@key].nil?
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.mpw_file.read_data')}\n#{e}"
|
||||
end
|
||||
|
||||
|
@ -159,7 +159,7 @@ class MPW
|
|||
end
|
||||
|
||||
File.rename(tmp_file, @wallet_file)
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
File.unlink(tmp_file) if File.exist?(tmp_file)
|
||||
|
||||
raise "#{I18n.t('error.mpw_file.write_data')}\n#{e}"
|
||||
|
@ -343,7 +343,7 @@ class MPW
|
|||
crypto = GPGME::Crypto.new(armor: true)
|
||||
|
||||
crypto.decrypt(data, password: @gpg_pass).read.force_encoding('utf-8')
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.gpg_file.decrypt')}\n#{e}"
|
||||
end
|
||||
|
||||
|
@ -360,7 +360,7 @@ class MPW
|
|||
end
|
||||
|
||||
crypto.encrypt(data, recipients: recipients).read
|
||||
rescue Exception => e
|
||||
rescue => e
|
||||
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue