Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(apps): add stack ID in error message #1008

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}