Powershell catching exception type
问题 Is there a convenient way to catch types of exceptions and inner exceptions for try-catch purposes? Example code: $a = 5 $b = Read-Host "Enter number" $c = $a / $b #error if $b -eq 0 $d = get-content C:\I\Do\Not\Exist Row #3 will generate a runtime error with an inner exception (EDIT: fixed this command $Error[1].Exception.InnerException.GetType()), row #4 will generate a "standard"(?) type of exception ($Error[0].Exception.GetType()). Is it possible to get the desired result from both of