diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index 0c96ecdd5..9ceb64fe1 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -88,6 +88,14 @@ class Throttled(APIException): self.detail = detail or self.default_detail +class PreconditionFailed(APIException): + status_code = status.HTTP_412_PRECONDITION_FAILED + default_detail = 'Object has been updated since you retrieved it.' + + def __init__(self, detail=None): + self.detail = detail or self.default_detail + + class ConfigurationError(Exception): """ Indicates an internal server error.