Exercise 1: Why try/catch Doesn't Catch Get-Item's Error — Possible Solution ==================================================================== WHY THE CATCH BLOCK NEVER FIRES ------------------------------ Per this chapter, most built-in cmdlet errors - including Get-Item failing on a path that doesn't exist - are NON-TERMINATING by default. A non-terminating error just gets displayed in red and execution continues on to the next statement, exactly as though nothing had interrupted it. try/catch only intercepts TERMINATING errors - ones that actually stop execution at that point. Since Get-Item's own missing-path error is non-terminating, it never stops anything, so there's nothing for the catch block to intercept - the try block simply keeps running past it, and catch never activates. THE SINGLE CHANGE THAT FIXES IT ------------------------------ Adding -ErrorAction Stop to the Get-Item call converts that specific error from non-terminating to terminating, which is exactly what allows catch to actually intercept it: Get-Item C:\does-not-exist.txt -ErrorAction Stop. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly identifies that Get-Item's error is non-terminating by default, correctly explains that try/catch only intercepts terminating errors, and correctly names -ErrorAction Stop as the single fix that makes the catch block actually fire.