mirror of
https://github.com/nishiki/manage-password.git
synced 2024-11-27 07:33:05 +00:00
add exception message in error_msg
This commit is contained in:
parent
96073ca103
commit
9ddd6f0a73
1 changed files with 14 additions and 14 deletions
28
lib/MPW.rb
28
lib/MPW.rb
|
@ -60,8 +60,8 @@ class MPW
|
||||||
File.open(@file_config, 'w') do |file|
|
File.open(@file_config, 'w') do |file|
|
||||||
file << config.to_yaml
|
file << config.to_yaml
|
||||||
end
|
end
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Can't write the config file!"
|
@error_msg = "Can't write the config file!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ class MPW
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Checkconfig failed!"
|
@error_msg = "Checkconfig failed!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -125,12 +125,12 @@ class MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
rescue
|
rescue Exception => e
|
||||||
if !@file_pwd.nil? && File.exist?(@file_pwd)
|
if !@file_pwd.nil? && File.exist?(@file_pwd)
|
||||||
File.delete(@file_pwd)
|
File.delete(@file_pwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
@error_msg = "Can't decrypt file!"
|
@error_msg = "Can't decrypt file!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -165,8 +165,8 @@ class MPW
|
||||||
file_gpg.close
|
file_gpg.close
|
||||||
|
|
||||||
return true
|
return true
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Can't encrypt the GPG file!"
|
@error_msg = "Can't encrypt the GPG file!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -304,8 +304,8 @@ class MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Can't export, impossible to write in #{file}!"
|
@error_msg = "Can't export, impossible to write in #{file}!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -329,8 +329,8 @@ class MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Can't import, impossible to read #{file}!"
|
@error_msg = "Can't import, impossible to read #{file}!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -356,8 +356,8 @@ class MPW
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
rescue
|
rescue Exception => e
|
||||||
@error_msg = "Can't import, impossible to read #{file}!"
|
@error_msg = "Can't import, impossible to read #{file}!\n#{e}"
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue