Chapter4 Example8: exception handling