Added try and catch

This commit is contained in:
Markus Fleschutz
2020-10-05 13:12:12 +02:00
parent 14ab054646
commit 847be37772
25 changed files with 199 additions and 110 deletions

View File

@ -7,5 +7,9 @@
# License: CC0
$GeoLocation="" # empty means determine automatically
(Invoke-WebRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
exit 0
try {
(Invoke-WebRequest http://wttr.in/$GeoLocation -UserAgent "curl" ).Content
exit 0
} catch { Write-Error $Error[0] }
exit 1