Added error handling to the problem description.