-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add exceptions to @future_safe; deprecate FutureResultE #1880
Conversation
not sure about quality of PR and deleting FutureResultE, but project is in beta, kinda breaking changes are allowed I guess |
CHANGELOG.md
Outdated
@@ -10,6 +10,8 @@ See [0Ver](https://0ver.org/). | |||
|
|||
### Features | |||
|
|||
- Add picky exceptions to `future_safe` decorator like `safe` has. | |||
- Remove FutureResultE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, don't remove it just yet. Let's first provide an alternative. Moreover, maintaining an alias is simple enough.
future_instance = _coro_three('0') | ||
|
||
await future_instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future_instance = _coro_three('0') | |
await future_instance | |
await _coro_three('0') |
future_instance = _coro_two(0) | ||
|
||
assert isinstance(future_instance, FutureResult) | ||
assert isinstance(await future_instance, IOFailure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to check that IOFailure
has an expected error.
) -> int: | ||
return 1 | ||
|
||
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.Exception]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be:
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.Exception]" | |
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.ValueError]" |
) -> int: | ||
return 1 | ||
|
||
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.Exception]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.Exception]" | |
reveal_type(test) # N: Revealed type is "def (first: builtins.int, second: Union[builtins.str, None] =, *, kw: builtins.bool =) -> returns.future.FutureResult[builtins.int, builtins.ValueError]" |
I will help you with that! Thanks! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1880 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 80 80
Lines 2485 2523 +38
Branches 437 446 +9
=========================================
+ Hits 2485 2523 +38 ☔ View full report in Codecov by Sentry. |
Thanks a lot! |
I have added exceptions to @future_safe; removed FutureResultE
Checklist
CHANGELOG.md
Related issues