end of the video should refactor it
This commit is contained in:
10
1.Basic/12.Function_error.ps1
Normal file
10
1.Basic/12.Function_error.ps1
Normal file
@@ -0,0 +1,10 @@
|
||||
function Test {
|
||||
[CmdletBinding()] #turns into adv function
|
||||
param(
|
||||
[int32] $PingCount
|
||||
)
|
||||
Test-Connection google.com -Count $PingCount
|
||||
Write-Error -Message "It' a trap" -ErrorAction Stop
|
||||
}
|
||||
|
||||
try {Test -ErrorAction Stop} catch {Write-Output "Launch problem!" Write-Output $_}
|
||||
Reference in New Issue
Block a user