Gracefully handle less-than-perfect unit state data.
Merge pull request #640 from kadams54/fix-js-errors-1388465

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.
Have the token respect flags on the service.