Prerequisites
Steps to reproduce
I am expecting a problem with «Invoke-WebRequest» in «Try-Catch».
I think error should generated when Internet connection is breaking, but next operator in Try-block is running.
The file on the disk remains PARTIALLY downloaded without any errors raising.
Expected behavior
I starts the downloading and reboots the router.
Try {Invoke-WebRequest -URI TheLargeFile -ErrorAction Stop; Write-Host "Error NOT exist"}
Catch {Write-Host "Error exist"}
Error exist
Actual behavior
I starts the downloading and reboots the router.
Try {Invoke-WebRequest -URI TheLargeFile -ErrorAction Stop; Write-Host "Error NOT exist"}
Catch {Write-Host "Error exist"}
Error NOT exist
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.1.4
PSEdition Core
GitCommitId 7.1.4
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
I am expecting a problem with «Invoke-WebRequest» in «Try-Catch».
I think error should generated when Internet connection is breaking, but next operator in Try-block is running.
The file on the disk remains PARTIALLY downloaded without any errors raising.
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response