Skip to content

Commit

Permalink
Add err to message when config write fails in azd login (#1372)
Browse files Browse the repository at this point in the history
Add err to message when config write fails in `azd login`. Also, address false-positive warning of `AZD_DEBUG` not set in `--debug` mode.

Co-authored-by: Wei Lim <[email protected]>
  • Loading branch information
pamelafox and weikanglim authored Jan 12, 2023
1 parent 8874829 commit 28ddb71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cli/azd/cmd/middleware/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ func (m *DebugMiddleware) Run(ctx context.Context, next NextFn) (*actions.Action
return next(ctx)
}

debug, err := strconv.ParseBool(os.Getenv("AZD_DEBUG"))
debugStr := os.Getenv("AZD_DEBUG")
if debugStr == "" {
return next(ctx)
}

debug, err := strconv.ParseBool(debugStr)
if err != nil {
log.Printf("failed converting AZD_DEBUG to boolean: %s", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion cli/azd/pkg/config/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (c *manager) Save(config Config, filePath string) error {

err = os.WriteFile(filePath, configJson, osutil.PermissionFile)
if err != nil {
return fmt.Errorf("failed writing configuration data")
return fmt.Errorf("failed writing configuration data: %w", err)
}

return nil
Expand Down

0 comments on commit 28ddb71

Please sign in to comment.