compiler: properly format cue errors

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-01-12 11:23:40 -08:00
parent 4f26c8ff4f
commit b5427cfbaa

View File

@ -8,6 +8,7 @@ import (
"sync"
"cuelang.org/go/cue"
cueerrors "cuelang.org/go/cue/errors"
cueload "cuelang.org/go/cue/load"
"github.com/pkg/errors"
)
@ -103,7 +104,7 @@ func (cc *Compiler) Build(ctx context.Context, fs FS, args ...string) (*Value, e
}
inst, err := cc.Cue().Build(instances[0])
if err != nil {
return nil, err
return nil, errors.New(cueerrors.Details(err, &cueerrors.Config{}))
}
return cc.Wrap(inst.Value(), inst), nil
}