#NEWLINE# def set_error_serializer( self , serializer ) : #NEWLINE# #INDENT# 'Override the default serializer for instances of HTTPError.\n\n        When a responder raises an instance of HTTPError, Falcon converts\n        it to an HTTP response automatically. The default serializer\n        supports JSON and XML, but may be overridden by this method to\n        use a custom serializer in order to support other media types.\n\n        The ``falcon.HTTPError`` class contains helper methods, such as\n        `to_json()` and `to_dict()`, that can be used from within\n        custom serializers. For example::\n\n            def my_serializer(req, resp, exception):\n                representation = None\n\n                preferred = req.client_prefers((\'application/x-yaml\',\n                                                \'application/json\'))\n\n                if preferred is not None:\n                    if preferred == \'application/json\':\n                        representation = exception.to_json()\n                    else:\n                        representation = yaml.dump(exception.to_dict(),\n                                                   encoding=None)\n                    resp.body = representation\n                    resp.content_type = preferred\n\n        Note:\n            If a custom media type is used and the type includes a\n            "+json" or "+xml" suffix, the default serializer will\n            convert the error to JSON or XML, respectively. If this\n            is not desirable, a custom error serializer may be used\n            to override this behavior.\n\n        Args:\n            serializer (callable): A function taking the form\n                ``func(req, resp, exception)``, where `req` is the request\n                object that was passed to the responder method, `resp` is\n                the response object, and `exception` is an instance of\n                ``falcon.HTTPError``.\n\n        ' #NEWLINE# if ( len ( inspect . getargspec ( serializer ) . args ) == 2 ) : #NEWLINE# #INDENT# serializer = helpers . wrap_old_error_serializer ( serializer ) #NEWLINE# #UNINDENT# self . _serialize_error = serializer