Added error handling for failed requests

ImageSearch master

Added check for network connection before making a request.