(MODULES-2962) Fix error handling acceptance test
(MODULES-2962) Fix error handling acceptance test

We were previously testing that this module handled exceptions
correctly by using 'Write-Error'. This worked incidently, but was not
technically correct. 'Write-Error' is a non-terminating error which
does not equate to a non-zero exit code. However, if it is the only
command sent to the PowerShell console, the PowerWhell host reports it
as a non-zero exit code. If something is added after 'Write-Error',
then a zero exit code is returned.

This can be seen in the following example:

PS C:\vagrant> powershell -command "write-error foo"
write-error foo : foo
    + CategoryInfo          : NotSpecified: (:) [Write-Error],
    WriteErrorException
        + FullyQualifiedErrorId :
        Microsoft.PowerShell.Commands.WriteErrorException
PS C:\vagrant> $LASTEXITCODE
1
PS C:\vagrant> powershell -command "write-error foo;ls"
write-error foo;ls : foo
    + CategoryInfo          : NotSpecified: (:) [Write-Error],
    WriteErrorException
        + FullyQualifiedErrorId :
        Microsoft.PowerShell.Commands.WriteErrorException

            Directory: C:\vagrant

Mode                LastWriteTime     Length Name
....
PS C:\vagrant> $LASTEXITCODE
0

The fix for this is to use 'throw' when we are testing that this module
can return a non-zero exit code.

Iristyle/puppetlabs-powershell,ferventcoder/puppetlabs-powershell,jpogran/puppetlabs-powershell,jpogran/puppetlabs-powershell,puppetlabs/puppetlabs-powershell