If the service is returning an error, this function should raise an exception.
        such as SkipThisService
966770
def check_error(self, response):
        
        if response.status_code == 500:
            raise ServiceError("500 - " + response.content)

        if response.status_code == 503:
            if "DDoS protection by Cloudflare" in response.content:
                raise ServiceError("Foiled by Cloudfare's DDoS protection")
            raise ServiceError("503 - Temporarily out of service.")

        if response.status_code == 429:
            raise ServiceError("429 - Too many requests")

        if response.status_code == 404:
            raise ServiceError("404 - Not Found")

        if response.status_code == 400:
            raise ServiceError("400 - Bad Request")
301023
function(message, response) {
    HttpError.call(this, message, code, description, response, false)
    Error.captureStackTrace(this, arguments.callee)
  }
827928
def raiseError(cls, message):
        
        error_message = "[error] %s" % message
        if cls.__raise_exception__:
            raise Exception(error_message)

        cls.colorprint(error_message, Fore.RED)
        sys.exit(1)
880046
def raise_error(error_type: str) -> None:
    """"""
    try:
        error = next((v for k, v in ERROR_CODES.items() if k in error_type))
    except StopIteration:
        error = AirVisualError
    raise error(error_type)
1316824
def exception(  # type: ignore
        self, msg, *args, exc_info=True, **kwargs
    ) -> Task:
        
        return self.error(msg, *args, exc_info=exc_info, **kwargs)
658626
def catches(exc, handler=re_raise):
    '''
    
    '''
    if not __CHECKING__:
        return lambda f: f

    def wrap(f):
        def call(*args, **kwd):
            try:
                ID = exc_checker.set_attention(exc)
                res = f(*args, **kwd)
                exc_checker.remove_attention(exc, ID)
                return res
            # handle checked exception
            except exc, e:
                exc_checker.remove_attention(exc, ID)
                traceback = sys.exc_info()[2]
                return handler(exc, str(e), traceback.tb_next.tb_next)
            # re-raise unchecked exception but remove checked exeption info first
            except Exception, e:
                exc_checker.remove_attention(exc, ID)
                traceback = sys.exc_info()[2]
                raise e.__class__, e.args, traceback.tb_next.tb_next
        call.__name__ = f.__name__
        return call
    return wrap
1233202
def try_catch(func, *args, **kwargs):
    '''
    
    '''
    try:
        return log_debug(func, *args, **kwargs)
    except Exception as exc:
        logging.debug('Error in "%s" in thread %s: %s', func.__name__, current_thread(), exc)
        return exc
1301650
def handleError(self, test, err, capt=None):
        
        if not hasattr(test.test, "testcase_guid"):
            if err[0] == errors.BlockedTest:
                raise SkipTest(err[1])
                return True

            elif err[0] == errors.DeprecatedTest:
                raise SkipTest(err[1])
                return True

            elif err[0] == errors.SkipTest:
                raise SkipTest(err[1])
                return True
979831
def exception(self, timeout=None):
        """"""
        # Check exceptional case: return none if no error
        if not self._poll(timeout).HasField('error'):
            return None

        # Return expected error
        return self._operation.error
205742
def _raise_exception(self, args, kwargs):
        

        error_message = (
            "Received unexpected call to '{}' on {!r}.  The supplied arguments "
            "{} do not match any available allowances."
        )

        raise UnallowedMethodCallError(
            error_message.format(
                self._method_name,
                self._target.obj,
                build_argument_repr_string(args, kwargs)
            )
        )
1284650
def _method_error_handler(self, response: Dict[str, Any]):
        
        exp = response.get('MESSAGE')
        code = response.get("CODE")
        ID = exp.get("ID")
        e = abort(code, ID=ID, message=exp.get('MESSAGE'))
        self.tasks[ID].set_exception(e)
        return True
737653
def exception(cls, method, uri, response, message):
        
        # noinspection PyBroadException
        try:
            error_payload = json.loads(response.text)
            if 'message' in error_payload:
                message = '{}: {}'.format(message, error_payload['message'])
            code = error_payload.get('code', response.status_code)
            return TwilioRestException(response.status_code, uri, message, code, method)
        except Exception:
            return TwilioRestException(response.status_code, uri, message, response.status_code, method)
1314145
function noerror(/*...*/) { // function can be referenced within each task as this.noerror
            try { tasks.length ? tasks.shift().apply(funcs[0], arguments) : next.apply(this, [null].concat(Array.prototype.slice.call(arguments))) }
            catch (ex) { next(ex) } // return any thrown exception as the argument to next()
        }
1181725
def _raise_error(self, *args, **kwargs):
        
        log.debug("_raise_error(): %s" % kwargs)
        try:
            error_code = str(kwargs['code'])
        except KeyError as e:
            raise FaultyPayloadError('_raise_error(): %s' % kwargs)

        try:
            raise self._code_handlers[error_code]()
        except KeyError:
            raise UnknownWSSError()
632887
def error_catcher(self, extra_info: Optional[str] = None):
        
        try:
            yield
        except InstaloaderException as err:
            if extra_info:
                self.error('{}: {}'.format(extra_info, err))
            else:
                self.error('{}'.format(err))
            if self.raise_all_errors:
                raise
750542
def error(self, msg: str) -> None:
        
        # noinspection PyUnresolvedReferences
        servicemanager.LogErrorMsg(str(msg))
        if self.debugging:
            log.error(msg)
455522
function throwError(error, scheduler) {
    if (!scheduler) {
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return subscriber.error(error); });
    }
    else {
        return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); });
    }
}