def _return_error_or_exception(self, cls, resp, content):
        if self.raise_except:
            raise cls(resp, content)
        else:
            # content type can contain both the mimetype and the charset (e.g. text/xml; charset=utf-8)
            if resp.get('content-type', "").startswith("text/xml") or resp.get('content-type', "").startswith("application/xml"):
                conn_l.info("Returning an error document, due to HTTP response code %s" % resp.status)
                e = Error_Document(content, code=resp.status, resp = resp)
                return e
            else:
                conn_l.info("Returning due to HTTP response code %s" % resp.status)
                e = Error_Document(code=resp.status, resp = resp)
                return e
Internal method for reporting errors, behaving as the `self.raise_except` flag requires.
dataset/ETHPy150Open swordapp/python-client-sword2/sword2/connection.py/Connection._return_error_or_exception