'Can be overridden to customize response classes used for uncaught
exceptions. Should always return a subclass of
``django.http.HttpResponse``.'

def get_response_class_for_exception(self, request, exception):

    if isinstance(exception, (NotFound, ObjectDoesNotExist, Http404)):
        return HttpResponseNotFound
    elif isinstance(exception, UnsupportedSerializationFormat):
        return http.HttpNotAcceptable
    elif isinstance(exception, UnsupportedDeserializationFormat):
        return http.HttpUnsupportedMediaType
    elif isinstance(exception, UnsupportedFormat):
        return http.HttpBadRequest
    return http.HttpApplicationError
