]> Dogcows Code - chaz/groupsecret/blobdiff - lib/App/GroupSecret.pm
improve error message for no keyfile or secret
[chaz/groupsecret] / lib / App / GroupSecret.pm
index 98f321232d184d112fedb75f82cd105e4719e17d..ce85e9db419432d9576e6be1d48b042c31deebda 100644 (file)
@@ -114,7 +114,6 @@ Get the path to the keyfile.
 
 sub filepath {
     shift->{filepath} ||= $ENV{GROUPSECRET_KEYFILE} || 'groupsecret.yml';
-
 }
 
 =method file
@@ -152,7 +151,11 @@ sub _action_print_secret {
     ) or pod2usage(2);
 
     my $file = $self->file;
-    die "No secret in file -- use the \`set-secret' command to set one.\n" if !$file->secret;
+    my $filepath = $file->filepath;
+    die "No keyfile '$filepath' exists -- use the \`add-key' command to create one.\n"
+        unless -e $filepath && !-d $filepath;
+    die "No secret in keyfile '$filepath' exists -- use the \`set-secret' command to set one.\n"
+        if !$file->secret;
 
     if ($decrypt) {
         my $private_key = $self->private_key;
This page took 0.019626 seconds and 4 git commands to generate.