diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index 71419b54a..cb62787be 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -91,13 +91,18 @@ class ErrorDetail(str): return not self.__eq__(other) def __repr__(self): - base = 'ErrorDetail(string=%r, code=%r' % ( + if self.params: + return 'ErrorDetail(string=%r, code=%r, params=%s)' % ( + str(self), + self.code, + self.params + ) + + return 'ErrorDetail(string=%r, code=%r)' % ( str(self), self.code, ) - return base + ', params=%r)' % self.params if self.params else base + ')' - def __hash__(self): return hash(str(self))