Helps object methods handle MatrixRequestError.

    Args:
        method(function): Object method to be wrapped

    Method's object must have _handle_request_exception method that deals with
    specific status codes and errcodes.
330942
def intent(method):
    

    def wrapper(self, *args, **kwargs):
        try:
            return method(self, *args, **kwargs)
        except exceptions.MatrixError as e:
            if isinstance(e.original_exception,
                          matrix_client.errors.MatrixRequestError):
                self._handle_request_exception(e)
                # May still throw exception for other reasons; not handled
                return method(self, *args, **kwargs)
            else:
                raise e

    return wrapper
307786
def method_missing(method, *args, &block)
      raise Checky::Exception unless methods.include?("populate_#{method}".to_sym)
      @storage.send("#{method}=", send("populate_#{method}", *args, &block))
      @storage.checky_blocks[method.to_sym] = block if block_given?
    rescue Checky::Exception
      @self_before_instance_eval.send method, *args, &block if @self_before_instance_eval.present?
    end
153647
def method_missing method, *args, &block
      method, *args = special_handler(method, *args, &block) \
        if self.private_methods.include?(:special_handler)
      [method, args].flatten
    end
176494
def handler ( method )
      raise TypeError,  error_message(method, __method__) unless method.instance_of? Method
      @handler = method
    end
1093037
private void handleResponseError(String method, URI uri, Response response)
    {
        if(throwExceptions 
             && response.getStatus() != 200 
             && response.getStatus() != 201 
             && response.getStatus() != 204)
        {
            ErrorResponse error = null;
            if(response.hasEntity())
                error = response.readEntity(ERROR);
            throw new ErrorResponseException(method, response.getStatus(), 
                response.getStatusInfo().getReasonPhrase(), error);
        }
    }
171871
def http_method(self, method):
        
        self.build_url()

        try:
            response = self.get_http_method(method)
            is_success = response.ok

            try:
                response_message = response.json()
            except ValueError:
                response_message = response.text

        except requests.exceptions.RequestException as exc:
            is_success = False
            response_message = exc.args

        return is_success, response_message
356925
def (self, method):
        
        def _handler(callback, schema=None):
            """
            _handler
            """
            # reentrant default is False [POST, DELETE, PUT]
            reentrant = False
            if method == "get":
                reentrant = True

            self.handlers.append({
                "method": method,
                "callback": callback,
                "schema": schema,
                "reentrant": reentrant
            })
            return self

        return _handler
784136
def call(self, method, params):
        
        msgid = self._endpoint.send_request(method, params)
        while True:
            if not self._endpoint.receive_messages():
                raise EOFError("EOF")
            res = self._endpoint.get_response(msgid)
            if res:
                result, error = res
                if error is None:
                    return result
                raise RPCError(error)
            self._process_input_notification()
            self._process_input_request()
357976
function( object, method ) {
            return function(){
                var args = arguments;
                if ( args === undefined ){
                    args = [];
                }
                return method.apply( object, args );
            };
        }
1170953
def _method_error_handler(self, response: Dict[str, Any]):
        
        exp = response.get('MESSAGE')
        code = response.get("CODE")
        ID = exp.get("ID")
        raise abort(code, ID=ID, message=exp.get('MESSAGE'))
713959
def CallMethod(self, method, controller, request, response_class, done):
        '''
        '''
        try:
            self.validate_request(request)

            if not self.sock:
                self.get_connection(self.host, self.port)

            self.send_rpc_message(method, request)

            byte_stream = self.recv_rpc_message()
            return self.parse_response(byte_stream, response_class)
        except RequestError:  # Raise a request error, but don't close the socket
            raise
        except Exception:  # All other errors close the socket
            self.close_socket()
            raise
1016432
def handle_single_request(self, request_object):
        
        if not isinstance(request_object, (MethodCall, Notification)):
            raise TypeError("Invalid type for request_object")

        method_name = request_object.method_name
        params = request_object.params
        req_id = request_object.id

        request_body = self.build_request_body(method_name, params, id=req_id)
        http_request = self.build_http_request_obj(request_body)

        try:
            response = urllib.request.urlopen(http_request)
        except urllib.request.HTTPError as e:
            raise CalledServiceError(e)

        if not req_id:
            return

        response_body = json.loads(response.read().decode())
        return response_body
585010
def method_missing(method, *args, &block) # :nodoc:
      case method.to_s
      when /^(.*)\?$/
        return !self.send($1.to_s).nil?
      when /^clear_(.*)$/
        self.send("#{$1.to_s}=", nil)
      else
        super
      end
    end
615986
def trace_method(method):
    

    def wrapper(*args, **kwargs):
        try:
            method(*args, **kwargs)
        except Exception:
            args[0].print_exception("A worker thread crashed:\n" + traceback.format_exc())

    return wrapper
1031804
def block(cls, method):
        
        def blocked_method(self, *a, **kw):
            raise cls(self, method.__name__, a, kw)
        return blocked_method
293304
def handle_not_allowed(environ, start_response):
    
    _methods = util.wsgi_path_item(environ, '_methods')
    headers = {}
    if _methods:
        headers['allow'] = str(_methods)
    raise webob.exc.HTTPMethodNotAllowed(
        ('The method specified is not allowed for this resource.'),
        headers=headers, json_formatter=util.json_error_formatter)
1166742
protected function handle_request( $method, $request_method, array $arguments = [] ) {
		if ( empty( $method ) || 'page' === $method ) {
			$page = max( ( isset( $arguments[0] ) ? intval( $arguments[0] ) : 1 ), 1 );
			$this->pager( $page );
			exit;
		} else {
			// Call method if exists.
			if ( $this->invoke( $method, $request_method, $arguments ) ) {
				exit;
			} else {
				$this->method_not_found();
			}
		}
	}