Skip to content

Commit

Permalink
Improve stat error for recover
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Oct 10, 2023
1 parent 6bbb40f commit e2300fe
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import (
"go.uber.org/zap"
)

var errInvalidInputPath = errors.New("invalid file input path")
var (
errInvalidInputPath = errors.New("invalid file input path")
errInvalidFileSource = errors.New("invalid input file source")
)

// restoreCfg is the restore command configuration
type restoreCfg struct {
Expand Down Expand Up @@ -86,10 +89,10 @@ func (c *restoreCfg) exec(ctx context.Context, _ []string) error {
return errInvalidInputPath
}

// Make sure the output file can be overwritten, if it exists
// Make sure the input file exists
if _, err := os.Stat(c.inputPath); err != nil {
// File already exists, and the overwrite flag is not set
return errOutputFileExists
// Unable to verify input file existence
return fmt.Errorf("%w, %w", errInvalidFileSource, err)
}

// Set up the client
Expand Down

0 comments on commit e2300fe

Please sign in to comment.