The main goal for this exercise is to employ exceptions as a mechanism to
avoid the use of uninitialized values for a certain type. Your job is to
Options package, you'll declare the
type, which contains the
Unitialized value, and the actual options:
Option_3. You'll also implement
Image function, which returns a string for the
type. In case the argument to
function must raise the
Unitialized_Value exception. This exception,
too, must be part of the
Options package specification.
In this exercise, you'll use the test procedure
Tests package below. Your job is to add exception handling
Check_Exception procedure based on the following requirements:
- If the exception raised by
Constraint_Error, the procedure should displays a "Constraint_Error detected!" message to the user.
- Otherwise, it should display the message associated with the exception
— you can use the
Exception_Messagefunction to retrieve the message.
In this exercise, you'll extend the implementation of the
Check_Exception procedure from the previous exercise. Your goal is
to change the procedure, so that it re-raises the exception raised by
Num_Exception_Test — in addition to displaying the messages
that you already implemented in the previous exercise. Naturally, you can
use the code for the
Check_Exception procedure from the previous
exercise as a starting point.