Skip to content

Invoke-WebRequest do not generate error at break of connection while downloading #16122

@7-904-001-67-28

Description

@7-904-001-67-28

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions