'Exception handling for __enter__ and __exit__
This reports on the exception we\'re handling and special cases
subclasses of BuildEnvironmentException.  For
:py:class:`BuildEnvironmentWarning`, exit this context gracefully, but
don\'t mark the build as a failure.  For all other exception classes,
including :py:class:`BuildEnvironmentError`, the build will be marked as
a failure and the context will be gracefully exited.'

def handle_exception(self, exc_type, exc_value, _):

    if (exc_type is not None):
        log.error(LOG_TEMPLATE.format(project=self.project.slug, version=self.version.slug, msg=exc_value), exc_info=True)
        if (not issubclass(exc_type, BuildEnvironmentWarning)):
            self.failure = exc_value
        return True
