Skip to content

Commit b9327e7

Browse files
committed
Update: Add task name label
1 parent bd76f64 commit b9327e7

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

alteriso5/cmd/build/work/buildtask.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package work
22

3+
import (
4+
"fmt"
5+
)
6+
37
type BuildTask struct {
48
name string
59
task func(work Work) error
610
}
711

8-
912
func NewBuildTask(name string, task func(Work) error) *BuildTask {
1013
return &BuildTask{
1114
name: name,
@@ -18,5 +21,9 @@ func (t *BuildTask) Name() string {
1821
}
1922

2023
func (t *BuildTask) Run(w *Work) error {
21-
return t.task(*w)
24+
err := t.task(*w)
25+
if err != nil {
26+
return fmt.Errorf("error running task %s: %v", t.name, err)
27+
}
28+
return nil
2229
}

0 commit comments

Comments
 (0)