Problem: powershell script stops because of an exception which should be caught by the try block when using $ErrorActionPreference
Example:
$ErrorActionPreference = 'Stop'
try {
ThisCommandWillThrowAnException
} catch {
Write-Error 'Caught an Exception'
}
# this line is not executed.
Write-Output 'Continuing execution'