Special case handling of empty workflow files for user experience (#349)
Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
3eef111e46
commit
b6f1df4d2f
1 changed files with 5 additions and 0 deletions
|
@ -1,12 +1,14 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,6 +84,9 @@ func NewWorkflowPlanner(path string) (WorkflowPlanner, error) {
|
||||||
workflow, err := ReadWorkflow(f)
|
workflow, err := ReadWorkflow(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.Close()
|
f.Close()
|
||||||
|
if err == io.EOF {
|
||||||
|
return nil, errors.WithMessagef(err, "unable to read workflow, %s file is empty", file.Name())
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if workflow.Name == "" {
|
if workflow.Name == "" {
|
||||||
|
|
Loading…
Reference in a new issue