Gracefully handle imperfect unit state data.

When inspecting units for errors, we need to be able to deal with malformed or missing data returned from the API. We already know an error condition exists, so there's no guarantee things will be as they should. Inspect as many fields as possible to determine if there's a relation error. Don't assume a field is actually present; if it isn't, move on.
Line 1430 is where we check `unit.agent_state` to verify that it's an error. That comparison gets AND'd with `relationError` to return true only for relation errors.