Log exception for catching custom exception in init handler

For tracking error easily when custom exception is raised, log exception
as well before transitioning to failed state.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2018-10-31 16:57:53 +08:00
parent 5d3ea762c6
commit 476c51e1f4

View File

@@ -157,6 +157,7 @@ def init(config, session, msg):
build.transition(conf, models.BUILD_STATES["wait"])
# Catch custom exceptions that we can expose to the user
except (UnprocessableEntity, Forbidden, ValidationError, RuntimeError) as e:
log.exception(str(e))
# Rollback changes underway
session.rollback()
build.transition(conf, models.BUILD_STATES["failed"], state_reason=str(e))