mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
13d1bbb45f
Remove dependency on yaml.Node for internal AST representation. Yaml decoder is now just another decoder.
21 lines
481 B
Go
21 lines
481 B
Go
package yqlib
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func errorOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
|
|
log.Debugf("-- errorOperation")
|
|
|
|
rhs, err := d.GetMatchingNodes(context.ReadOnlyClone(), expressionNode.RHS)
|
|
if err != nil {
|
|
return Context{}, err
|
|
}
|
|
errorMessage := "aborted"
|
|
if rhs.MatchingNodes.Len() > 0 {
|
|
errorMessage = rhs.MatchingNodes.Front().Value.(*CandidateNode).Value
|
|
}
|
|
return Context{}, fmt.Errorf(errorMessage)
|
|
}
|