Module pugsql.exceptions
Exception types raised by PugSQL. PugSQL will also raise built-in exceptions when they're appropriate.
Source code
"""
Exception types raised by PugSQL. PugSQL will also raise built-in exceptions
when they're appropriate.
"""
__pdoc__ = {}
class ParserError(ValueError):
"""
Exception raised when syntax errors are encountered parsing PugSQL files.
"""
token = None
def __init__(self, message, token):
"""
Creates a new ParserError given a message and the token indicating the
position of the error. Builds a user-facing error message indicating
the file, line, and column of the error.
"""
super(ParserError, self).__init__(
'Error in %s:%s:%s - %s' % (
token.context.sqlfile,
token.context.line,
token.context.col,
message))
self.token = token
__pdoc__['ParserError.token'] = (
'The `pugsql.lexer.Token` indicating the position of the error '
'encountered during parsing.')
class NoConnectionError(RuntimeError):
"""
Exception raised when a PugSQL module is not connected to a database.
"""
def __init__(self):
super(NoConnectionError, self).__init__(
'No connection engine is configured. Pass a connection string '
"to the module's connect method, or pass a SQLAlchemy engine "
'to the set_engine method.')
class InvalidArgumentError(AttributeError):
"""
Exception raised when a PugSQL statement is called with incorrect
arguments.
"""
Classes
class InvalidArgumentError (*args, **kwargs)
-
Exception raised when a PugSQL statement is called with incorrect arguments.
Source code
class InvalidArgumentError(AttributeError): """ Exception raised when a PugSQL statement is called with incorrect arguments. """
Ancestors
- builtins.AttributeError
- builtins.Exception
- builtins.BaseException
class NoConnectionError
-
Exception raised when a PugSQL module is not connected to a database.
Source code
class NoConnectionError(RuntimeError): """ Exception raised when a PugSQL module is not connected to a database. """ def __init__(self): super(NoConnectionError, self).__init__( 'No connection engine is configured. Pass a connection string ' "to the module's connect method, or pass a SQLAlchemy engine " 'to the set_engine method.')
Ancestors
- builtins.RuntimeError
- builtins.Exception
- builtins.BaseException
class ParserError (message, token)
-
Exception raised when syntax errors are encountered parsing PugSQL files.
Creates a new ParserError given a message and the token indicating the position of the error. Builds a user-facing error message indicating the file, line, and column of the error.
Source code
class ParserError(ValueError): """ Exception raised when syntax errors are encountered parsing PugSQL files. """ token = None def __init__(self, message, token): """ Creates a new ParserError given a message and the token indicating the position of the error. Builds a user-facing error message indicating the file, line, and column of the error. """ super(ParserError, self).__init__( 'Error in %s:%s:%s - %s' % ( token.context.sqlfile, token.context.line, token.context.col, message)) self.token = token
Ancestors
- builtins.ValueError
- builtins.Exception
- builtins.BaseException
Class variables
var token
-
The
Token
indicating the position of the error encountered during parsing.