Skip to content

Commit

Permalink
Apply suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
0michalsokolowski0 committed Sep 9, 2024
1 parent 41ffe56 commit 64b2af1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions internal/cmd/stack/stack_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,21 @@ func getStack(cliCtx *cli.Context) (*stack, error) {
if cliCtx.IsSet(flagStackID.Name) {
stackID := cliCtx.String(flagStackID.Name)
stack, err := stackGetByID(cliCtx.Context, stackID)
if errors.Is(err, errNoStackFound) {
return nil, fmt.Errorf("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", stackID)
}
if err != nil {
if errors.Is(err, errNoStackFound) {
return nil, fmt.Errorf("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", stackID)
}

return nil, fmt.Errorf("failed to check if stack exists: %w", err)
}

return stack, nil
} else if cliCtx.IsSet(flagRun.Name) {
runID := cliCtx.String(flagRun.Name)
stack, err := stackGetByRunID(cliCtx.Context, runID)
if errors.Is(err, errNoStackFound) {
return nil, fmt.Errorf("run with id %q was not found. Please check that the run exists and that you have access to it. To list available stacks run: spacectl stack run list", runID)
}
if err != nil {
if errors.Is(err, errNoStackFound) {
return nil, fmt.Errorf("run with id %q was not found. Please check that the run exists and that you have access to it. To list available stacks run: spacectl stack run list", runID)
}

return nil, fmt.Errorf("failed to get stack by run id: %w", err)
}

Expand Down

0 comments on commit 64b2af1

Please sign in to comment.