if (error.response){ //do something }else if(error.request){ //do something else }else if(error.message){ //do something other than the other two }