change error check logic into utils class and timeout for DNS lookup