resp is undefined on an error

The resp object is usually null or undefined if there is a network error.