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

Test and Document Exception.__cause__ on NetworkError #3792

Merged
merged 9 commits into from Jul 18, 2023

Conversation

Bibo-Joshi
Copy link
Member

Closes #3778 as suggested by Noam in the dev chat.

Tests for {Base, HTTPX}Request not extended yet.

@Bibo-Joshi Bibo-Joshi marked this pull request as ready for review July 6, 2023 18:55
Copy link
Member

@lemontree210 lemontree210 left a comment

Choose a reason for hiding this comment

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

I have a general question: it was my understanding that if we raise some exception from another exception, we don't need to specify any cause explicitly. I think that's the way it's formulated in the docs and I personally have found raise ... from ... quite informative on its own.

If a user wants to check the cause explicitly, I think they can use .__cause__ (as per the same docs).

So what am I missing here? :)

@Bibo-Joshi
Copy link
Member Author

Huh. I really just didn't know that. Makes sense that raise … from has to be stored somehow, but I wasn't aware that this is documented. A bit weird though that __cause__ is not documented as proper attribute 🤔 Moreorever, that attribute apparently is not pickled: python/cpython#73652.
I'd be okay with the non-pickable thing if we agree that __cause__ can bes considered to be public python API …

@Bibo-Joshi Bibo-Joshi changed the title Add NetworkError.cause Test and Document `Exception. Jul 16, 2023
@Bibo-Joshi Bibo-Joshi changed the title Test and Document `Exception. Test and Document Exception.__cause__ on NetworkError Jul 16, 2023
Copy link
Member

@lemontree210 lemontree210 left a comment

Choose a reason for hiding this comment

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

Some punctuation nitpicks in docstring, maybe not even justified :)

telegram/error.py Outdated Show resolved Hide resolved
telegram/error.py Outdated Show resolved Hide resolved
Co-authored-by: Dmitry Kolomatskiy <58207913+lemontree210@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
@Bibo-Joshi Bibo-Joshi merged commit 7226aae into master Jul 18, 2023
24 checks passed
@Bibo-Joshi Bibo-Joshi deleted the timeout-subclasses branch July 18, 2023 10:02
@github-actions github-actions bot locked and limited conversation to collaborators Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] More fine grained network exceptions
3 participants