New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`repr` call after `AppException` instantiation raises `AttributeError` #197

annawoodard opened this Issue Apr 5, 2018 · 1 comment


None yet
2 participants

annawoodard commented Apr 5, 2018

The custom str method of AppException just reproduces the base class str method. The only thing the custom repr does is change the format, but I think we should consider sticking to the baseclass version for improved readability (it matches the built-in format); additionally, it introduces a bug because if reason is not set, the repr call will fail with an AttributeError.

In [28]: from import ParslError, AppException

In [29]: x = ParslError('baz')

In [30]: y = AppException('baz')

In [31]: x

In [32]: y

In [33]: repr(x)
Out[33]: "ParslError('baz',)"

In [34]: repr(y)
AttributeError                            Traceback (most recent call last)
<ipython-input-34-2a48cbef3bc0> in <module>()
----> 1 repr(y)

~/ci/parsl/parsl/app/ in __repr__(self)
     41     def __repr__(self):
---> 42         return "{0} Reason:{1}".format(self.__class__, self.reason)
     44     def __str__(self):

AttributeError: 'AppException' object has no attribute 'reason'

In [35]: y.reason = 'baz'

In [36]: repr(y)
Out[36]: "<class ''> Reason:baz"

@annawoodard annawoodard self-assigned this Apr 5, 2018


This comment has been minimized.


yadudoc commented Apr 10, 2018

I don't see a regression test added for this one. Let's add one and close this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment