Summary
Your goal was to gain experience creating and throwing customized exception objects that can be caught and handled within a catch
code block.
By creating, throwing, catching, and handling customized exceptions, you simplify the process for exposing and correcting programmatic issues within your application. Customizing exceptions with information specific to your application enables you to optimize the explanation of issues within the application's user interface. Throwing exceptions within a method and using C#'s built in support for catching exception objects at any level within the call stack helps to ensure that issues are caught where they can be handled.
Without the ability to create and throw customized exception objects, your code would be more difficult to maintain and the user experience would suffer.
Reference materials
You can find additional information about using exceptions here: https://learn.microsoft.com/dotnet/csharp/fundamentals/exceptions/using-exceptions.
You can find additional information about creating and throwing here: https://learn.microsoft.com/dotnet/csharp/fundamentals/exceptions/creating-and-throwing-exceptions.
You can find additional information about creating user defined exceptions here: https://learn.microsoft.com/dotnet/standard/exceptions/how-to-create-user-defined-exceptions.
You can find additional information about localized exception messages here: https://learn.microsoft.com/dotnet/standard/exceptions/how-to-create-localized-exception-messages.
You can find additional information about explicitly throwing exceptions here: https://learn.microsoft.com/dotnet/standard/exceptions/how-to-explicitly-throw-exceptions.
You can find additional information about using specific exceptions here: https://learn.microsoft.com/dotnet/standard/exceptions/how-to-use-specific-exceptions-in-a-catch-block.
Get a free verified certification
Microsoft and freeCodeCamp.org offer a training and certification combo on foundational C#. By completing this Learn module, you've already started. Explore freeCodeCamp's Foundational C# with Microsoft certification here: https://aka.ms/csharp-certification.