Implemented a more proper error handling for data service.