def __init__(self, msg=None, *, hint=None, details=None, token=None, line=None, col=None, expr=None, context=None): if msg is None: msg = 'syntax error at or near "%s"' % token super().__init__(msg, hint=hint, details=details) self.token = token if line is not None: self.line = line if col is not None: self.col = col self.expr = expr if context: add_context(self, context) if line is None and col is None: self.line = context.start.line self.col = context.start.column
def __init__(self, msg, *, context=None): super().__init__(msg) if context: add_context(self, context) self._attrs['L'] = context.start.line self._attrs['C'] = context.start.column
def __init__(self, msg, *, context=None): super().__init__(msg) if context: add_context(self, context) self.line = context.start.line self.col = context.start.column else: self.line = self.col = self.context = None
def to_source(cls, node, indent_with=' ' * 4, add_line_information=False, pretty=True): try: return super().to_source(node, indent_with=indent_with, add_line_information=add_line_information, pretty=pretty) except SQLSourceGeneratorError as e: ctx = SQLSourceGeneratorContext(node) edgedb_error.add_context(e, ctx) raise
def _run_codegen(qtree): codegen = pgcodegen.SQLSourceGenerator() try: codegen.visit(qtree) except pgcodegen.SQLSourceGeneratorError as e: # pragma: no cover ctx = pgcodegen.SQLSourceGeneratorContext(qtree, codegen.result) edgedb_error.add_context(e, ctx) raise except Exception as e: # pragma: no cover ctx = pgcodegen.SQLSourceGeneratorContext(qtree, codegen.result) err = pgcodegen.SQLSourceGeneratorError( 'error while generating SQL source') edgedb_error.add_context(err, ctx) raise err from e return codegen
def __init__(self, msg, *, node=None, details=None, hint=None): super().__init__(msg, details=details, hint=hint) if node is not None: ctx = SQLSourceGeneratorContext(node) edgedb_error.add_context(self, ctx)