summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/terraform/terraform/eval_error.go
blob: 470f798b7fc61909576651a14732b992ad5ae641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package terraform

// EvalReturnError is an EvalNode implementation that returns an
// error if it is present.
//
// This is useful for scenarios where an error has been captured by
// another EvalNode (like EvalApply) for special EvalTree-based error
// handling, and that handling has completed, so the error should be
// returned normally.
type EvalReturnError struct {
	Error *error
}

func (n *EvalReturnError) Eval(ctx EvalContext) (interface{}, error) {
	if n.Error == nil {
		return nil, nil
	}

	return nil, *n.Error
}