Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def raise_syntax_error(self, message, token=None):
if token is None:
raise DjangoQLParserError(message)
lexer = token.lexer
if callable(getattr(lexer, 'find_column', None)):
column = lexer.find_column(token)
else:
column = None
raise DjangoQLParserError(
message=message,
value=token.value,
line=token.lineno,
column=column,
)
def raise_syntax_error(self, message, token=None):
if token is None:
raise DjangoQLParserError(message)
lexer = token.lexer
if callable(getattr(lexer, 'find_column', None)):
column = lexer.find_column(token)
else:
column = None
raise DjangoQLParserError(
message=message,
value=token.value,
line=token.lineno,
column=column,
)