Skip to content

Commit a8e15a6

Browse files
Furistoroboquat
authored andcommitted
Write unique error message if ready file create fails
1 parent 8cecf63 commit a8e15a6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

components/content-service/pkg/initializer/initializer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,29 +490,29 @@ func PlaceWorkspaceReadyFile(ctx context.Context, wspath string, initsrc csapi.W
490490
gitpodDir := filepath.Join(wspath, filepath.Dir(WorkspaceReadyFile))
491491
err = os.MkdirAll(gitpodDir, 0777)
492492
if err != nil {
493-
return xerrors.Errorf("cannot write workspace ready file: %w", err)
493+
return xerrors.Errorf("cannot create directory for workspace ready file: %w", err)
494494
}
495495
err = os.Chown(gitpodDir, uid, gid)
496496
if err != nil {
497-
return xerrors.Errorf("cannot write workspace-ready file: %w", err)
497+
return xerrors.Errorf("cannot chown directory for workspace ready file: %w", err)
498498
}
499499

500500
tempWorkspaceReadyFile := WorkspaceReadyFile + ".tmp"
501501
fn := filepath.Join(wspath, tempWorkspaceReadyFile)
502502
err = os.WriteFile(fn, []byte(fc), 0644)
503503
if err != nil {
504-
return xerrors.Errorf("cannot write workspace ready file: %w", err)
504+
return xerrors.Errorf("cannot write workspace ready file content: %w", err)
505505
}
506506
err = os.Chown(fn, uid, gid)
507507
if err != nil {
508-
return xerrors.Errorf("cannot write workspace ready file: %w", err)
508+
return xerrors.Errorf("cannot chown workspace ready file: %w", err)
509509
}
510510

511511
// Theia will listen for a rename event as trigger to start the tasks. This is a rename event
512512
// because we're writing to the file and this is the most convenient way we can tell Theia that we're done writing.
513513
err = os.Rename(fn, filepath.Join(wspath, WorkspaceReadyFile))
514514
if err != nil {
515-
return xerrors.Errorf("cannot write workspace ready file: %w", err)
515+
return xerrors.Errorf("cannot rename workspace ready file: %w", err)
516516
}
517517

518518
return nil

0 commit comments

Comments
 (0)