Created
November 3, 2020 12:11
-
-
Save AvgustPol/294a11703860c08ab2c5fdcb5d8718b0 to your computer and use it in GitHub Desktop.
the best way to deal with try-catch I`ve found so far
This file contains hidden or 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 { ... } | |
catch { | |
Write-Host "An error occurred:" | |
Write-Host $_ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_try_catch_finally?view=powershell-7#accessing-exception-information