core: Don't swallow errors in EvalApply

Incorrect pointer discipline here was causing the error to be lost rather
than returned as expected.

Additionally we'll include a log line in this case because otherwise an
apply error is reported so far from the actual apply operation that it
can be difficult to understand what happened.
This commit is contained in:
Martin Atkins 2018-09-11 16:28:50 -07:00
parent 084e25c60a
commit d043dec488
1 changed files with 2 additions and 1 deletions

View File

@ -161,7 +161,8 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
// success.
if n.Error != nil {
err := diags.Err()
n.Error = &err
*n.Error = err
log.Printf("[DEBUG] %s: apply errored, but we're indicating that via the Error pointer rather than returning it: %s", n.Addr.Absolute(ctx.Path()), err)
return nil, nil
}
}