Skip to content
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

Let OutcomeException inherit from Exception instead of BaseException #12235

Open
JCZuurmond opened this issue Apr 22, 2024 · 3 comments
Open
Labels
type: docs documentation improvement, missing or needing clarification

Comments

@JCZuurmond
Copy link

JCZuurmond commented Apr 22, 2024

What's the problem this feature will solve?

This allows for the usual handling and follows the Python documentation.

Describe the solution you'd like

Replace inheritance of OutcomeException from BaseException with Exception

Alternative Solutions

I can rewrite the code to expect a BaseException, but it does not follow Pythons recommend practice of inheriting user defined exceptions from Exception

Additional context

I'm curious to learn what the motivation is for inheriting from BaseException instead of Exception.

@RonnyPfannschmidt
Copy link
Member

-10 on this

its a BaseException cause people like to catch `Exception without handling proper Passover for the outcomes
a user is NOT supposed to catch those without re-raising

most users easily do so by accident thus breaking the intended function

@JCZuurmond
Copy link
Author

JCZuurmond commented Apr 22, 2024

Hi @RonnyPfannschmidt , thank you for your answer.

If I understand correctly, usage has shown that people catch exceptions in their tests using the bare Exception?

In any case, could the docstring of the OutcomeException be updated explaining the choice for inheriting from the BaseException? The motivation is not clear for me when reading the code

@RonnyPfannschmidt
Copy link
Member

RonnyPfannschmidt commented Apr 22, 2024

Added a clarifying note would be great

@bluetech bluetech added the type: docs documentation improvement, missing or needing clarification label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

No branches or pull requests

3 participants