Merge pull request #456 from dubo-dubon-duponey/crash

Fix crasher
This commit is contained in:
Andrea Luzzardi 2021-05-12 16:20:32 -07:00 committed by GitHub
commit 835ac9eef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,10 +57,20 @@ func Build(sources map[string]fs.FS, args ...string) (*Value, error) {
if len(instances) != 1 { if len(instances) != 1 {
return nil, errors.New("only one package is supported at a time") return nil, errors.New("only one package is supported at a time")
} }
for _, value := range instances {
if value.Err != nil {
return nil, value.Err
}
}
v, err := c.Context.BuildInstances(instances) v, err := c.Context.BuildInstances(instances)
if err != nil { if err != nil {
return nil, errors.New(cueerrors.Details(err, &cueerrors.Config{})) return nil, errors.New(cueerrors.Details(err, &cueerrors.Config{}))
} }
for _, value := range v {
if value.Err() != nil {
return nil, value.Err()
}
}
if len(v) != 1 { if len(v) != 1 {
return nil, errors.New("internal: wrong number of values") return nil, errors.New("internal: wrong number of values")
} }