summaryrefslogtreecommitdiff
path: root/lib/App/Raps2.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-04-03 16:54:40 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-04-03 16:54:40 +0200
commit3f2a49b697a6eb5ff8db78c05c65070b46bb75a6 (patch)
tree3c8597bbd372ec704d96c28f31935a6c733acfcd /lib/App/Raps2.pm
parentc9b94ac51383501ea80e0485cba4f891dbcce3fa (diff)
Use confess instead of return undef, Test::Exception for App::Raps2::Password test
Diffstat (limited to 'lib/App/Raps2.pm')
-rw-r--r--lib/App/Raps2.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 4746e5a..8078653 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -12,6 +12,7 @@ use base 'Exporter';
use App::Raps2::Password;
use App::Raps2::UI;
+use Carp q(confess);
use File::Path qw(make_path);
use File::Slurp qw(slurp write_file);
@@ -82,9 +83,7 @@ sub get_master_password {
passphrase => $pass,
);
- if (not $self->{'pass'}->verify($self->{'master_hash'})) {
- return undef;
- }
+ $self->{'pass'}->verify($self->{'master_hash'});
}
sub create_config {
@@ -122,7 +121,7 @@ sub cmd_add {
my $ui = $self->{'ui'};
if (-e $pwfile) {
- return undef;
+ confess('Password file already exists');
}
$self->get_master_password();
@@ -157,7 +156,7 @@ sub cmd_dump {
my $pwfile = $self->{'xdg_data'} . "/${name}";
if (not -e $pwfile) {
- return undef;
+ confess('Password file does not exist');
}
my %key = file_to_hash($pwfile);
@@ -182,7 +181,7 @@ sub cmd_info {
my $pwfile = $self->{'xdg_data'} . "/${name}";
if (not -e $pwfile) {
- return undef;
+ confess('Password file does not exist');
}
my %key = file_to_hash($pwfile);