Handling errors in the models using handleError