Parse the body after you have checked for an error

Only parse body when there is response. Don't do anything before you've checked if there is an error