Skip to content

Commit 4a3810c

Browse files
ExecUtilException::__repr__ is updated (#9)
* ExecUtilException::__repr__ is updated * ExecUtilException::__repr__ supports subclasses - asserts were removed - "type(self).__name__" is used
1 parent c71c685 commit 4a3810c

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/exceptions.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ def error(self) -> typing.Optional[T_ERR_DATA]:
9090
return self._error
9191

9292
def __repr__(self) -> str:
93-
assert type(self) == ExecUtilException # noqa: E721
94-
assert __class__ == ExecUtilException # noqa: E721
95-
9693
args = []
9794

9895
if self._description is not None:
@@ -110,12 +107,11 @@ def __repr__(self) -> str:
110107
if self._error is not None:
111108
args.append(("error", self._error))
112109

113-
result = "{}(".format(__class__.__name__)
110+
result = "{}(".format(type(self).__name__)
114111
sep = ""
115112
for a in args:
116-
if a[1] is not None:
117-
result += sep + a[0] + "=" + repr(a[1])
118-
sep = ", "
113+
result += sep + a[0] + "=" + repr(a[1])
114+
sep = ", "
119115
continue
120116
result += ")"
121117
return result

0 commit comments

Comments
 (0)