implemented exception handling exercise.