Prevent recursion on error translation #443
Conversation
| # Since the error is not translate, the __cause__ would | ||
| # be None | ||
| with pytest.raises(NoCredentialsError) as exc: | ||
| s3.info("test/a.txt") |
There was a problem hiding this comment.
Does this case print the "During handling of the above exception, another exception occurred:" message that generally worries users? Perhaps we should set ex.__suppress_context__ = True in every case.
There was a problem hiding this comment.
Does this case print the "During handling of the above exception, another exception occurred:" message that generally worries users?
Though in this case (NoCredentialsFound), the exception won't be in the context of anything will it? Considering that it is the only exception. For the rest (like the ones s3fs translates), setting __cause__ would implicitly set __suppress_context__ true.
|
OK, I think this is an improvement. It certainly gives us a single point to improve messaging in the future, should we wish to do so. |
Resolves #442