Skip to content

Feature/add called from info on waiting for early return exception #72

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

Conversation

acostapazo
Copy link
Contributor

@acostapazo acostapazo commented Jan 4, 2024

Before:

If you want to handle this error and return a Failure, please use early_return decorator on your function.

Now

If you want to handle this error and return a Failure, please use early_return decorator on your function (foo in your_python_script.py)


def __init__(self, result: "AnyResult") -> None:
self.result = result
try:
stack = inspect.stack()[2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Por qué 2 y 3? Seguro que estos índices no cambian?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the doc: https://docs.python.org/3/library/inspect.html#inspect.stack

inspect.stack()[2] -> filename

And the when we get the FrameInfo, we use [3] to access function

@acostapazo acostapazo merged commit 1b10033 into main Jan 25, 2024
@acostapazo acostapazo deleted the feature/add-called-from-info-on-waiting-for-early-return-exception branch January 25, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants