Skip to content

Commit

Permalink
Improve error message when repo is not linked or token is expired (#5089
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mehulkar committed May 24, 2023
1 parent 8ca8b67 commit b0b81de
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cli/internal/runsummary/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,24 @@ func newSpacesClient(spaceID string, api *client.APIClient, ui cli.Ui) *spacesCl
api: api,
ui: ui,
spaceID: spaceID,
enabled: spaceID != "",
enabled: false, // Start with disabled
requests: make(chan *spaceRequest), // TODO: give this a size based on tasks
runCreated: make(chan struct{}, 1),
run: &spaceRun{},
}

if c.enabled && !c.api.IsLinked() {
c.errors = append(c.errors, fmt.Errorf("Error: experimentalSpaceId is enabled, but repo is not linked to a Space. Run `turbo link --target=spaces`"))
c.enabled = false
if spaceID == "" {
return c
}

if !c.api.IsLinked() {
c.errors = append(c.errors, fmt.Errorf("Error: experimentalSpaceId is enabled, but repo is not linked to API. Run `turbo link` or `turbo login` first"))
return c
}

// Explicitly enable if all conditions are met
c.enabled = true

return c
}

Expand Down

0 comments on commit b0b81de

Please sign in to comment.