Modified the error handling to catch non-xml errors, like privilege-related ones.

The error I got from trying to access the API with an unsufficient privileged account was an XML parsing error, which was a bit uninformative, so this should help spotting errors, in case the error message fails to be parsed properly