diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2021-01-14 18:55:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2021-01-14 18:55:59 +0000 |
| commit | 41ca37734aa4f293ac5fb63c239d78185c8ec983 (patch) | |
| tree | 372f172e38ba565df1a6b3acb9c70c843eed3735 /lib/sqlalchemy | |
| parent | 4d20df14846e644b88fbe8a288116422bf5e343e (diff) | |
| parent | b4c6cfc2fde6c652e79ca157f8023a3f8941bc3c (diff) | |
| download | sqlalchemy-41ca37734aa4f293ac5fb63c239d78185c8ec983.tar.gz | |
Merge "Use UnsupportedCompilationError for no default compiler"
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/exc.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/ext/compiler.py | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/sqlalchemy/exc.py b/lib/sqlalchemy/exc.py index b031c1610..08b1bb060 100644 --- a/lib/sqlalchemy/exc.py +++ b/lib/sqlalchemy/exc.py @@ -179,10 +179,10 @@ class UnsupportedCompilationError(CompileError): code = "l7de" - def __init__(self, compiler, element_type): + def __init__(self, compiler, element_type, message=None): super(UnsupportedCompilationError, self).__init__( - "Compiler %r can't render element of type %s" - % (compiler, element_type) + "Compiler %r can't render element of type %s%s" + % (compiler, element_type, ": %s" % message if message else "") ) diff --git a/lib/sqlalchemy/ext/compiler.py b/lib/sqlalchemy/ext/compiler.py index 5a31173ec..47fb6720b 100644 --- a/lib/sqlalchemy/ext/compiler.py +++ b/lib/sqlalchemy/ext/compiler.py @@ -425,9 +425,11 @@ def compiles(class_, *specs): return existing_dispatch(element, compiler, **kw) except exc.UnsupportedCompilationError as uce: util.raise_( - exc.CompileError( - "%s construct has no default " - "compilation handler." % type(element) + exc.UnsupportedCompilationError( + compiler, + type(element), + message="%s construct has no default " + "compilation handler." % type(element), ), from_=uce, ) @@ -476,9 +478,11 @@ class _dispatcher(object): fn = self.specs["default"] except KeyError as ke: util.raise_( - exc.CompileError( - "%s construct has no default " - "compilation handler." % type(element) + exc.UnsupportedCompilationError( + compiler, + type(element), + message="%s construct has no default " + "compilation handler." % type(element), ), replace_context=ke, ) |
