Adding upstream version 6.0.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d01130b3f1
commit
527597d2af
122 changed files with 23162 additions and 0 deletions
38
sqlglot/errors.py
Normal file
38
sqlglot/errors.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
from enum import auto
|
||||
|
||||
from sqlglot.helper import AutoName
|
||||
|
||||
|
||||
class ErrorLevel(AutoName):
|
||||
IGNORE = auto() # Ignore any parser errors
|
||||
WARN = auto() # Log any parser errors with ERROR level
|
||||
RAISE = auto() # Collect all parser errors and raise a single exception
|
||||
IMMEDIATE = auto() # Immediately raise an exception on the first parser error
|
||||
|
||||
|
||||
class SqlglotError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UnsupportedError(SqlglotError):
|
||||
pass
|
||||
|
||||
|
||||
class ParseError(SqlglotError):
|
||||
pass
|
||||
|
||||
|
||||
class TokenError(SqlglotError):
|
||||
pass
|
||||
|
||||
|
||||
class OptimizeError(SqlglotError):
|
||||
pass
|
||||
|
||||
|
||||
def concat_errors(errors, maximum):
|
||||
msg = [str(e) for e in errors[:maximum]]
|
||||
remaining = len(errors) - maximum
|
||||
if remaining > 0:
|
||||
msg.append(f"... and {remaining} more")
|
||||
return "\n\n".join(msg)
|
Loading…
Add table
Add a link
Reference in a new issue