Handle network failures

Closes #45 
/cc @alloy