-
-
Save bielawb/56d14f78b9a5d2286c9fb4c28b111a8c to your computer and use it in GitHub Desktop.
Więcej szczegółów o błędzie.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
Invoke-RestMethod -Uri http://psu.contoso.com/fail -ErrorAction Stop | |
} catch { | |
$szczegółyBłędu = [IO.StreamReader]::new( | |
$_.Exception.Response.GetResponseStream() | |
).ReadToEnd() | |
"Błąd - $_ - $szczegółyBłędu" | |
} | |
# Wynik: | |
# Błąd - The remote server returned an error: (404) Not Found. - Coś nie bangla! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment