Guest User

Untitled

a guest
May 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. try {
  2. $response = Invoke-WebRequest @myparams -EA Stop
  3. # do more stuff with the response
  4. } catch [System.Net.WebException] {
  5. # parse the JSON response body for error details
  6. }
  7.  
  8. try {
  9. $response = Invoke-WebRequest @myparams -EA Stop
  10. # do more stuff with the response
  11. } catch [System.Net.WebException] {
  12. # Desktop: parse the JSON response body for error details
  13. } catch [Microsoft.PowerShell.Commands.HttpResponseException] {
  14. # Core: parse the JSON response body for error details
  15. }
Add Comment
Please, Sign In to add comment