A more correct fix for 82cf61a

The lack of an "as" clause was intended, the real bug was a misnamed
variable containing the error message to be logged.
Merge pull request #15203 from terminalmage/fix-chcocolatey-exception

A more correct fix for 82cf61a