Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to send a message doesnt generate an error #21

Closed
SQLDBAWithABeard opened this issue Jul 29, 2020 · 3 comments
Closed

Failing to send a message doesnt generate an error #21

SQLDBAWithABeard opened this issue Jul 29, 2020 · 3 comments

Comments

@SQLDBAWithABeard
Copy link

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

image

@PrzemyslawKlys
Copy link
Member

Can't reproduce your error:

image

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?

@PrzemyslawKlys
Copy link
Member

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.

@PrzemyslawKlys
Copy link
Member

PrzemyslawKlys commented Jul 29, 2020

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.

PrzemyslawKlys added a commit that referenced this issue Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants