Added case for network error

Also fixed indentation