Skip to content

Commit 0bc433d

Browse files
authored
Fix -clear-cache flag when cache is cleared and improve error handling (#176)
* Fix -clear-cache flag when cache is cleared and improve error handling * Use %q instead of single quotes
1 parent 7c476f1 commit 0bc433d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

cmd/src/actions_cache.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ func (c actionExecutionDiskCache) clear(ctx context.Context, key actionExecution
8989
return err
9090
}
9191

92+
if _, err := os.Stat(path); os.IsNotExist(err) {
93+
return nil
94+
}
95+
9296
return os.Remove(path)
9397
}
9498

cmd/src/actions_exec_backend_runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func runAction(ctx context.Context, prefix, repoID, repoName, rev string, steps
233233
elapsed := time.Since(t0).Round(time.Millisecond)
234234
if err != nil {
235235
logger.DockerStepErrored(repoName, i, err, elapsed)
236-
return nil, errors.Wrap(err, "run docker container")
236+
return nil, errors.Wrapf(err, "Running Docker container for image %q failed", step.Image)
237237
}
238238
logger.DockerStepDone(repoName, i, elapsed)
239239

cmd/src/actions_exec_logger.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,14 @@ func (a *actionLogger) ActionFailed(err error, patches []PatchInput) {
7070
fmt.Fprintln(os.Stderr)
7171
if perr, ok := err.(parallel.Errors); ok {
7272
if len(patches) > 0 {
73-
yellow.Fprintf(os.Stderr, "✗ Action produced %d patches but failed with %d errors.\n\n", len(patches), len(perr))
73+
yellow.Fprintf(os.Stderr, "✗ Action produced %d patches but failed with %d errors:\n\n", len(patches), len(perr))
7474
} else {
75-
yellow.Fprintf(os.Stderr, "✗ Action failed with %d errors.\n", len(perr))
75+
yellow.Fprintf(os.Stderr, "✗ Action failed with %d errors:\n", len(perr))
7676
}
77+
for _, e := range perr {
78+
fmt.Fprintf(os.Stderr, "\t- %s\n", e)
79+
}
80+
fmt.Println()
7781
} else if err != nil {
7882
if len(patches) > 0 {
7983
yellow.Fprintf(os.Stderr, "✗ Action produced %d patches but failed with error: %s\n\n", len(patches), err)

0 commit comments

Comments
 (0)