addedin error handling for a class