'Processes CommentClientRequestErrors in ajax requests. If the request is an ajax request,
returns a http response that encodes the error as json'

def process_exception(self, request, exception):

    if (isinstance(exception, CommentClientRequestError) and request.is_ajax()):
        try:
            return JsonError(json.loads(exception.message), exception.status_code)
        except ValueError:
            return JsonError(exception.message, exception.status_code)
    return None
