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]))
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")
def _raise_cast_error(message): raise exceptions.BadQueryError("GQL function error: {}".format(message))