txampext/jsondialect.py
def _runResponder(self, responder, request, command, identifier):
        """Run the responser function. If it succeeds, add the _answer key.
        If it fails with an error known to the command, serialize the
        error.

        """
        d = defer.maybeDeferred(responder, **request)

        def _addIdentifier(response):
            """Return the response with an ``_answer`` key.

            """
            response["_answer"] = identifier
            return response

        def _serializeFailure(failure):
            """
            If the failure is serializable by this AMP command, serialize it.
            """
            key = failure.trap(*command.allErrors)
            response = {
                "_error_code": command.allErrors[key],
                "_error_description": str(failure.value),
                "_error": identifier
            }
            return response

        d.addCallbacks(_addIdentifier, _serializeFailure)
        return d
def _runResponder(self, responder, request, command, identifier):
        """Run the responser function. If it succeeds, add the _answer key.
        If it fails with an error known to the command, serialize the
        error.

        """
        d = defer.maybeDeferred(responder, **request)

        def _addIdentifier(response):
            """Return the response with an ``_answer`` key.

            """
            response["_answer"] = identifier
            return response

        def _serializeFailure(failure):
            """
            If the failure is serializable by this AMP command, serialize it.
            """
            key = failure.trap(*command.allErrors)
            response = {
                "_error_code": command.allErrors[key],
                "_error_description": str(failure.value),
                "_error": identifier
            }
            return response

        d.addCallbacks(_addIdentifier, _serializeFailure)
        return d
Run the responser function. If it succeeds, add the _answer key.
        If it fails with an error known to the command, serialize the
        error.