Change raise e from e
calls to be just raise
and remove unneeded ones
#2225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As per the discussion from #2221, the pattern,
can break downstream tooling that seeks to unroll
exc.__cause__
(e.g. for processing the stack trace).This PR tweaks all spots in the
pymilvus
codebase that were using that pattern to instead either just use this patternor, if the
try/except
didn't have any additional logic in theexcept
block, I removed thetry/except
entirely as a directreraise
would be redundant in those cases.NB As mentioned in #2221, I originally only noticed three spots where the
raise err from err
pattern was used. While working on this PR I found a number of others and I ended up changing all of them. As per @XuanYang-cn's comment, if there are important reasons for one or more of these spots to stay as-is, please let me know and I can revert the changes to that section accordingly.Testing
Finding all the spots
To find all the spots, I ran this
grep
On
master
branch, we get a non-zero number of hits with the expected pattern. On the branch for this PR, thegrep
returns no valuesTesting the fix
In one process, run
In another process, run
The
In [6]:
step will not through anAssertionError