2015-02-27 11:38:17 -06:00
|
|
|
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) {
|
2015-03-04 12:15:53 -06:00
|
|
|
if n.Error == nil {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2015-02-27 11:38:17 -06:00
|
|
|
return nil, *n.Error
|
|
|
|
}
|