Beispiel #1
0
    def _Error(self, error_message):
        """Generic query error.

        Args:
            error_message (str): message for the 'Parse Error' string.

        Raises:
            BadQueryError and passes on an error message from the caller. Will
                raise BadQueryError on all calls to _Error()
        """
        if self._next_symbol >= len(self._symbols):
            raise exceptions.BadQueryError("Parse Error: %s at end of string" %
                                           error_message)
        else:
            raise exceptions.BadQueryError(
                "Parse Error: %s at symbol %s" %
                (error_message, self._symbols[self._next_symbol]))
Beispiel #2
0
    def _to_filter(self, post=False):
        """(Attempt to) convert to a low-level filter instance.

        Args:
            post (bool): Indicates if this is a post-filter node.

        Raises:
            .BadQueryError: If ``post`` is :data:`False`, because there's no
                point submitting a query that will never return anything.
        """
        if post:
            return None
        raise exceptions.BadQueryError("Cannot convert FalseNode to predicate")
Beispiel #3
0
def _raise_cast_error(message):
    raise exceptions.BadQueryError("GQL function error: {}".format(message))