Skip to content

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

Closed

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

Activity

  1. CarloToso commented on Apr 20, 2023

    @CarloToso
    Contributor

    Related #12249

  2. ghost added
    In-PRIndicates that a PR is out for the issue
    on Apr 23, 2023
  3. ghost removed
    In-PRIndicates that a PR is out for the issue
    on Apr 27, 2023
  4. ghost added
    In-PRIndicates that a PR is out for the issue
    on Apr 27, 2023
  5. ghost removed
    In-PRIndicates that a PR is out for the issue
    on Jun 19, 2023
  6. ghost removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions