def __checkForErrors()

in wadebug/wa_actions/wabiz_api.py [0:0]


    def __checkForErrors(self, res_json, src_endpoint):
        errors = res_json.get("errors")
        if errors is not None:
            err = errors[0]
            if "code" in err and err["code"] == 1005:
                raise exceptions.WABizAccessError(
                    "This endpoint ({}) requires Admin role. "
                    "Please update the credentials in your "
                    "configuration (wadebug.conf.yml in current directory).".format(
                        src_endpoint
                    )
                )
            elif "code" in err and err["code"] == 1006:
                raise exceptions.WABizResourceNotFound(
                    "The requested resource at endpoint ({}) could not be found."
                    "\n{}".format(src_endpoint, err["details"])
                )
            else:
                raise exceptions.WABizGeneralError(
                    "The endpoint ({}) returned an errorneous response."
                    "\n{}".format(src_endpoint, err["details"])
                )