Challenge 2: An Exception Filter With when — Possible Solution ==================================================================== Program.cs: class ApiException : Exception { public int ErrorCode { get; } public ApiException(string message, int errorCode) : base(message) { ErrorCode = errorCode; } } static void CallApi(int codeToThrow) { throw new ApiException("API call failed", codeToThrow); } try { CallApi(503); } catch (ApiException e) when (e.ErrorCode == 503) { Console.WriteLine("Service unavailable -- retrying..."); } catch (ApiException e) { Console.WriteLine($"Unhandled API error {e.ErrorCode}: {e.Message}"); } Output: Service unavailable -- retrying... (Calling CallApi(404) instead would skip the first catch entirely -- its when condition evaluates to false -- and fall through to the second, unfiltered catch, printing "Unhandled API error 404: API call failed".) Explanation: The first catch block only fires when BOTH conditions hold: the thrown exception is an ApiException, AND its ErrorCode equals 503. For any other ErrorCode, the filter evaluates to false and the runtime moves on to check the next catch clause instead -- the second, unfiltered ApiException catch, which accepts any ErrorCode. No nested if-statement or manual re-throw was needed to express this. WHY THIS WORKS AS AN ANSWER ------------------------------ This uses catch (...) when (condition) exactly as the chapter introduces it, with a second, unfiltered catch as the fallback, demonstrating the type-and-condition combination the chapter describes as having no direct Java equivalent.