mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-13 22:38:46 +02:00
Added try and catch
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user