Tidy up comments and errors
This commit is contained in:
parent
4c49fd3e64
commit
d05cdf5ff3
4 changed files with 8 additions and 9 deletions
|
|
@ -34,8 +34,7 @@ func (a *App) Rebuild(ctx context.Context, codespaceName string) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// Users can't change their codespace while it's rebuilding, so there's
|
||||
// no need to execute this command.
|
||||
// There's no need to rebuild again because users can't modify their codespace while it rebuilds
|
||||
if codespace.State == api.CodespaceStateRebuilding {
|
||||
fmt.Fprintf(a.io.Out, "%s is already rebuilding\n", codespace.Name)
|
||||
return nil
|
||||
|
|
@ -43,13 +42,13 @@ func (a *App) Rebuild(ctx context.Context, codespaceName string) (err error) {
|
|||
|
||||
session, err := startLiveShareSession(ctx, codespace, a, false, "")
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("starting Live Share session: %w", err)
|
||||
}
|
||||
defer safeClose(session, &err)
|
||||
|
||||
err = session.Rebuild(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("couldn't rebuild codespace: %w", err)
|
||||
return fmt.Errorf("rebuilding codespace via session: %w", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(a.io.Out, "%s is rebuilding\n", codespace.Name)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func TestAlreadyRebuildingCodespace(t *testing.T) {
|
|||
|
||||
err := app.Rebuild(context.Background(), "rebuildingCodespace")
|
||||
if err != nil {
|
||||
t.Errorf("error rebuilding a codespace that is already rebuilding: %v", err)
|
||||
t.Errorf("rebuilding a codespace that was already rebuilding: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,13 +124,13 @@ func (s *Session) StartJupyterServer(ctx context.Context) (int, string, error) {
|
|||
}
|
||||
|
||||
func (s *Session) Rebuild(ctx context.Context) error {
|
||||
var success bool
|
||||
err := s.rpc.do(ctx, "IEnvironmentConfigurationService.rebuildContainer", []string{}, &success)
|
||||
var rebuildSuccess bool
|
||||
err := s.rpc.do(ctx, "IEnvironmentConfigurationService.rebuildContainer", []string{}, &rebuildSuccess)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invoking rebuild RPC: %w", err)
|
||||
}
|
||||
|
||||
if !success {
|
||||
if !rebuildSuccess {
|
||||
return fmt.Errorf("couldn't rebuild codespace")
|
||||
} else {
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ func TestRebuild(t *testing.T) {
|
|||
|
||||
err = session.Rebuild(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("rebuilding codespace over mock session: %v", err)
|
||||
t.Fatalf("rebuilding codespace via mock session: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue