Return extra info in error reponse
What is best way to return extra data such as error code in error type response. #Method 1 does not carry extra info while #Method 2 doesnt work.    

    #method 1
    ImmediateHttpResponse(HttpBadRequest('error')) #cant carry extra info


    #method 2
    class ErrorInfo(object):
        msg_id = ''
        msg_code = ''
        msg_content = ''

    class Resource(Resource):
        ....
        def get_object_list(self, request):
            if ...:
                error_info = ErrorInfo()
                error_info.msg_id = 'rt'
                error_info.msg_code = 'rerer'
                obj  = {'objects': error_info}
                return self.create_response(request, obj)
Return extra info in error reponse
===

What is best way to return extra data such as error code in error type response. #Method 1 does not carry extra info while #Method 2 doesnt work.    

    #method 1
    ImmediateHttpResponse(HttpBadRequest('error')) #cant carry extra info


    #method 2
    class ErrorInfo(object):
        msg_id = ''
        msg_code = ''
        msg_content = ''

    class Resource(Resource):
        ....
        def get_object_list(self, request):
            if ...:
                error_info = ErrorInfo()
                error_info.msg_id = 'rt'
                error_info.msg_code = 'rerer'
                obj  = {'objects': error_info}
                return self.create_response(request, obj)