ErrorDetails implementation

This commit is contained in:
kieffer julien 2020-08-28 12:03:06 +02:00
parent d1b8511f91
commit bf53e08f0f

View File

@ -91,13 +91,18 @@ class ErrorDetail(str):
return not self.__eq__(other) return not self.__eq__(other)
def __repr__(self): 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), str(self),
self.code, self.code,
) )
return base + ', params=%r)' % self.params if self.params else base + ')'
def __hash__(self): def __hash__(self):
return hash(str(self)) return hash(str(self))