json parse the body response. Or just assume that a 404 means person a is not following person b.
Can’t advise much else without seeing your code.
This is more a general issue with your code and not the API. So the language you are using would/can/should be able to handle a 404