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

Include fields on Exceptions, this addresses missing fields on Exception structs #41

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

mjpizz
Copy link
Contributor

@mjpizz mjpizz commented Jul 19, 2023

We had solved this in the old version of thrift-pyi (discussion here) but this appears to be a regression in latest version.

@unmade
Copy link
Owner

unmade commented Jul 22, 2023

Hey @mjpizz!

Thanks for bringing that up! I did rewrite a library not so long ago, but that behaviour seems to be in the old versions as well. In the result of the previous discussion we added __init__ to the exception classes, but completely forgot to add fields.

I see you have some tests failing. You can fix it by changing class NotFound... to:

class NotFound(Exception):
    message: Optional[str] = "Not Found"

    def __init__(self, message: Optional[str] = "Not Found") -> None: ...

That should be done in several places:

  • tests/stubs/expected/async/shared.pyi
  • tests/stubs/expected/optional/shared.pyi
  • tests/stubs/expected/sync/shared.pyi

@unmade
Copy link
Owner

unmade commented Jul 22, 2023

Also, if possible, please change version to the version = "0.6.0" in the pyproject.toml, so I can release it as soon a PR is merged

@unmade unmade requested review from unmade and removed request for unmade July 22, 2023 09:57
@mjpizz
Copy link
Contributor Author

mjpizz commented Jul 24, 2023

Easy enough :) made the changes, let me know when it's good to go.

@mjpizz
Copy link
Contributor Author

mjpizz commented Jul 27, 2023

@unmade what's the status on this? I think you might need to trigger the workflows since you're the maintainer.

@unmade
Copy link
Owner

unmade commented Jul 27, 2023

Thanks for reminding me! It's been a busy week for me and I completely forgot that some actions required from my part. I'll release it today

@codecov-commenter
Copy link

Codecov Report

Patch and project coverage have no change.

Comparison is base (696b810) 100.00% compared to head (5552b58) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #41   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           46        46           
  Branches         5         3    -2     
=========================================
  Hits            46        46           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@unmade unmade merged commit 7ab7009 into unmade:master Jul 27, 2023
6 checks passed
@mjpizz mjpizz deleted the patch-exception-output branch July 27, 2023 21:26
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.

3 participants