From f1ec7bedaf8dc6caea2df1547d892b6d645ad04c Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 30 Dec 2013 12:34:13 -0800 Subject: [PATCH] Raise type error instead of silencing it Instead of skipping the type error when invalid configuration values are provided instead we should just let the user know about these errors and let said user handle them appropriatly (by not passing in invalid configuration). Change-Id: Id17258e5e06b47bcabd2bfd9d02b9d21181244be --- taskflow/persistence/backends/impl_sqlalchemy.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/taskflow/persistence/backends/impl_sqlalchemy.py b/taskflow/persistence/backends/impl_sqlalchemy.py index f1d94f12..a3151225 100644 --- a/taskflow/persistence/backends/impl_sqlalchemy.py +++ b/taskflow/persistence/backends/impl_sqlalchemy.py @@ -210,11 +210,9 @@ class SQLAlchemyBackend(base.Backend): 'convert_unicode': misc.as_bool(conf.pop('convert_unicode', True)), 'pool_recycle': 3600, } - try: - idle_timeout = misc.as_int(conf.pop('idle_timeout', None)) + if 'idle_timeout' in conf: + idle_timeout = misc.as_int(conf.pop('idle_timeout')) engine_args['pool_recycle'] = idle_timeout - except TypeError: - pass sql_connection = conf.pop('connection') e_url = sa.engine.url.make_url(sql_connection) if 'sqlite' in e_url.drivername: @@ -228,10 +226,8 @@ class SQLAlchemyBackend(base.Backend): for (k, lookup_key) in [('pool_size', 'max_pool_size'), ('max_overflow', 'max_overflow'), ('pool_timeout', 'pool_timeout')]: - try: - engine_args[k] = misc.as_int(conf.pop(lookup_key, None)) - except TypeError: - pass + if lookup_key in conf: + engine_args[k] = misc.as_int(conf.pop(lookup_key)) # If the configuration dict specifies any additional engine args # or engine arg overrides make sure we merge them in. engine_args.update(conf.pop('engine_args', {}))