Skip to content

Commit b6f1df4

Browse files
cdbcplee
andauthored
Special case handling of empty workflow files for user experience (#349)
Co-authored-by: Casey Lee <[email protected]>
1 parent 3eef111 commit b6f1df4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/model/planner.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package model
22

33
import (
4+
"io"
45
"io/ioutil"
56
"math"
67
"os"
78
"path/filepath"
89
"sort"
910

11+
"github.com/pkg/errors"
1012
log "github.com/sirupsen/logrus"
1113
)
1214

@@ -82,6 +84,9 @@ func NewWorkflowPlanner(path string) (WorkflowPlanner, error) {
8284
workflow, err := ReadWorkflow(f)
8385
if err != nil {
8486
f.Close()
87+
if err == io.EOF {
88+
return nil, errors.WithMessagef(err, "unable to read workflow, %s file is empty", file.Name())
89+
}
8590
return nil, err
8691
}
8792
if workflow.Name == "" {

0 commit comments

Comments
 (0)