Skip to content

Commit

Permalink
Merge pull request #1008 from Scalingo/fix/976/apps-info_stack_name
Browse files Browse the repository at this point in the history
fix(apps): add stack ID in error message
  • Loading branch information
EtienneM authored Sep 20, 2023
2 parents 9e342bd + 772f9c4 commit 124f132
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions apps/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ import (
"os"

"github.com/olekukonko/tablewriter"
"github.com/pkg/errors"
"gopkg.in/errgo.v1"

"github.com/Scalingo/cli/config"
"github.com/Scalingo/go-scalingo/v6"
"github.com/Scalingo/go-scalingo/v6/debug"
"github.com/Scalingo/go-utils/errors/v2"
)

func Info(ctx context.Context, appName string) error {
c, err := config.ScalingoClient(ctx)
if err != nil {
return errgo.Notef(err, "fail to get Scalingo client")
return errors.Notef(ctx, err, "get Scalingo client")
}

app, err := c.AppsShow(ctx, appName)
if err != nil {
return errgo.Notef(err, "fail to get the application information")
return errors.Notef(ctx, err, "get the application information from the API")
}

stackName, err := getStackName(ctx, c, app.StackID)
Expand Down Expand Up @@ -54,5 +53,5 @@ func getStackName(ctx context.Context, c *scalingo.Client, stackID string) (stri
return stack.Name, nil
}
}
return "", errors.New("unknown stack")
return "", errors.Newf(ctx, "unknown stack '%v'", stackID)
}

0 comments on commit 124f132

Please sign in to comment.