added error handling to the menu class