filesystemwatcher and invoke-restmethod

Welcome Forums General PowerShell Q&A filesystemwatcher and invoke-restmethod

This topic contains 1 reply, has 1 voice, and was last updated by

3 years, 11 months ago.

  • Author
  • #23257

    Points: 0
    Rank: Member

    Can anyone advise why invoke-restmethod would not return error information when run within the -action {} block of a filesystemwatcher?

    I've tried using specific error variables and error actions, but I cannot get it to generate anything.

  • #23259

    Points: 0
    Rank: Member

    To be more specific, when invoke-restmethod is called outside the filesystemwatcher -action {} block, I get the following error (which is what I want to see)

    Invoke-RestMethod : Cannot create record.Invalid term for this field.00.000000
    At line:1 char:1
    + Invoke-RestMethod -uri " ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

    ...but inside the action script block, I get nothing.

    I am not interested in why I'm getting the error, only that I should get an error when there is a problem with the call.

The topic ‘filesystemwatcher and invoke-restmethod’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort