Revert "Revert "Implement network error handling""

This reverts commit e872a1845d13ef10d0008a3616ec720db7a14ebc.