Catch the right type of exceptions
The function get_table_class() catches the ValueError exception. Change it to catch TypeError and KeyError because these two are the only possible exceptions threw inside the function. test case of this change is covered in: https://review.openstack.org/#/c/419210/ Change-Id: I4b28d9bcee1dcff9f91b3535ea8dc07750e28abb Closes-Bug: #1655784
This commit is contained in:
parent
5cda5853c3
commit
6e34beb89a
|
@ -39,7 +39,7 @@ class DataBaseModelProcessor(object):
|
|||
def get_table_class(self, api_name, table_name):
|
||||
try:
|
||||
return self.db_models.get(api_name)[table_name]
|
||||
except ValueError:
|
||||
except(TypeError, KeyError):
|
||||
raise Exception('Unknown table name %s' % table_name)
|
||||
|
||||
def build_sqla_models(self, api_name, base=None):
|
||||
|
|
Loading…
Reference in New Issue