Closed SQLDBAWithABeard closed 4 years ago
Can't reproduce your error:
Send-TeamsMessage -uri $TeamsID -MessageTitle "Foo" -MessageText "Foo ❌ 😀 💩 bar" -Verbose
ShowErrors is strictly for Pester usage, Verbose does give you all the details. I would say the TeamsID you provided doesn't exists?
What would you expect here? detect the error and display it as a warning?
Weirdly enough if I remove one or two chars from the webhook URL it throws an error which displays warning
WARNING: Send-TeamsMessage - Couldn't send message. Error: The remote server returned an error: (400) Bad Request.
So in your case the 404 error must be non throwing for Invoke-RestMethod.
Added an option to detect error or failed strings within response from Invoke-RestMethod
. Hopefully, this will allow for a better understanding of something failed. Also added ErrorAction Stop. So far it wasn't needed as it was throwing errors, but maybe some edge case.
Please let me know if you find out what is the problem on your end? Published new version.
So I was trying to send a message to test the module
I tried to send a very simple message, nothing arrived, no error.
I searched for Get-Help (see #20 ) and then explored the parameters
I saw
-ShowErrors
I ran with that and still had no errors
I ran with verbose and saw the 404 error