[Ashwin]Added error handling to catch incase of connection error