Skip to content

Commit

Permalink
chore: improve user facing error massage when the stack is not found
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Wasilewski <[email protected]>
  • Loading branch information
mwasilew2 committed Sep 27, 2023
1 parent af7d32f commit 08fcc06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/cmd/stack/local_preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ func localPreview() cli.ActionFunc {
}

if err := authenticated.Client.Mutate(ctx, &uploadMutation, uploadVariables); err != nil {
return err
baseErrorMessage := "failed to upload local workspace"
if strings.Contains(err.Error(), "not found") {
return fmt.Errorf("%s: stack with ID %q could not be found. Please check that the stack exists and that you have access to it. To list available stacks run: spacectl stack list", baseErrorMessage, stackID)
}
return fmt.Errorf("%s: %w", baseErrorMessage, err)
}

fp := filepath.Join(os.TempDir(), "spacectl", "local-workspace", fmt.Sprintf("%s.tar.gz", uploadMutation.UploadLocalWorkspace.ID))
Expand Down

0 comments on commit 08fcc06

Please sign in to comment.