Special case handling of empty workflow files for user experience (#349)

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Cameron Booth 2020-08-31 14:50:01 -07:00 committed by GitHub
parent 3eef111e46
commit b6f1df4d2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,14 @@
package model
import (
"io"
"io/ioutil"
"math"
"os"
"path/filepath"
"sort"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
@ -82,6 +84,9 @@ func NewWorkflowPlanner(path string) (WorkflowPlanner, error) {
workflow, err := ReadWorkflow(f)
if err != nil {
f.Close()
if err == io.EOF {
return nil, errors.WithMessagef(err, "unable to read workflow, %s file is empty", file.Name())
}
return nil, err
}
if workflow.Name == "" {