# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):


import yaml
import falcon
import six
import deckhand.context
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from deckhand import errors
            return self.process_request(req, resp)

        try:
            return before_hook
        except AttributeError as ex:
            # No such method, we presume.
            message_template = ("Failed to get before hook from middleware "
                                "{0} - {1}")
            message = message_template.format(self.__name__, ex.message)
            LOG.error(message)
            raise errors.DeckhandException(message)

    def as_after_hook(self):
        """Extract process_response method as "after" hook
        :return: after hook function
        """

        # Need to wrap this up in a closure because the parameter counts
        # differ
        def after_hook(req, resp, resource=None):
            return self.process_response(req, resp, resource)

        try:
            return after_hook
        except AttributeError as ex:
            # No such method, we presume.
            message_template = ("Failed to get after hook from middleware "
                                "{0} - {1}")
            message = message_template.format(self.__name__, ex.message)
            LOG.error(message)

# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):


# Path: deckhand/control/middleware.py
import yaml
import falcon
import six
import deckhand.context
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from deckhand import errors

            return self.process_request(req, resp)

        try:
            return before_hook
        except AttributeError as ex:
            # No such method, we presume.
            message_template = ("Failed to get before hook from middleware "
                                "{0} - {1}")
            message = message_template.format(self.__name__, ex.message)
            LOG.error(message)
            raise errors.DeckhandException(message)

    def as_after_hook(self):
        """Extract process_response method as "after" hook
        :return: after hook function
        """

        # Need to wrap this up in a closure because the parameter counts
        # differ
        def after_hook(req, resp, resource=None):
            return self.process_response(req, resp, resource)

        try:
            return after_hook
        except AttributeError as ex:
            # No such method, we presume.
            message_template = ("Failed to get after hook from middleware "
                                "{0} - {1}")
            message = message_template.format(self.__name__, ex.message)
            LOG.error(message)

            raise errors.DeckhandException(message)