Added a check for body, before accessing body.error