Log exception info when objects fail to init
This will now log an error with a traceback indicating what caused the ProgrammingError exception instead of hiding the cause of the failure. Change-Id: I82e4d2c6961c6b456d129d8a0afd5972ff53785f
This commit is contained in:
parent
8a4dbf3eef
commit
ec70a02ddf
|
@ -279,9 +279,10 @@ class CinderPersistentObject(object):
|
||||||
# registration.
|
# registration.
|
||||||
try:
|
try:
|
||||||
cls.model = db.get_model_for_versioned_object(cls)
|
cls.model = db.get_model_for_versioned_object(cls)
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError) as e:
|
||||||
msg = _("Couldn't find ORM model for Persistent Versioned "
|
msg = _("Couldn't find ORM model for Persistent Versioned "
|
||||||
"Object %s.") % cls.obj_name()
|
"Object %s.") % cls.obj_name()
|
||||||
|
LOG.exception("Failed to initialize object.")
|
||||||
raise exception.ProgrammingError(reason=msg)
|
raise exception.ProgrammingError(reason=msg)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
|
Loading…
Reference in New Issue