René's URL Explorer Experiment


Title: fix: preserve exception cause by fercor-cisco · Pull Request #879 · googleapis/python-api-core · GitHub

Open Graph Title: fix: preserve exception cause by fercor-cisco · Pull Request #879 · googleapis/python-api-core

X Title: fix: preserve exception cause by fercor-cisco · Pull Request #879 · googleapis/python-api-core

Description: Fixes #880 Problem: When the retry mechanism re-raises non-retryable exceptions, it explicitly clears the exception chain by using raise final_exc from None. This breaks explicit exception chaining created with raise ... from ..., making the original cause (cause) inaccessible for debugging. Fix: Modified _default_exception_factory() in retry_base.py to preserve the __cause__ attribute when re-raising non-retryable exceptions. Instead of returning (exc_list[-1], None), we now return (exc_list[-1], getattr(exc_list[-1], '__cause__', None)). This ensures that exception chains are maintained through the retry mechanism, preserving debugging information and meeting developer expectations for exception handling. Testing: Added a new test case in tests/unit/retry/test_retry_base.py that checks that the cause from the chained exception is preserved by build_retry_error. Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea Ensure the tests and linter pass Code coverage does not decrease (if any source code was changed) Appropriate docs were updated (if necessary) Fixes # 🦕

Open Graph Description: Fixes #880 Problem: When the retry mechanism re-raises non-retryable exceptions, it explicitly clears the exception chain by using raise final_exc from None. This breaks explicit exception chaining...

X Description: Fixes #880 Problem: When the retry mechanism re-raises non-retryable exceptions, it explicitly clears the exception chain by using raise final_exc from None. This breaks explicit exception chaining...

Opengraph URL: https://github.com/googleapis/python-api-core/pull/879

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:9c176aaf-fa26-7d90-dcd2-6f99ad168357
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9970:33E8BE:1577B11:1F3A90A:6A4E46F0
html-safe-nonce6a193bd874b35c8413097b6163e8ea953f607b57646113403b5e1afd8865b369
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTcwOjMzRThCRToxNTc3QjExOjFGM0E5MEE6NkE0RTQ2RjAiLCJ2aXNpdG9yX2lkIjoiMjgxNTc5NTQ0MzEwMjc5NTUwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1eb913c907a60e45ad847cfb85bb5b7cbe607b3aafb85a2bc8b2df0182ed365d
hovercard-subject-tagpull_request:3119222080
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/googleapis/python-api-core/pull/879/files
twitter:imagehttps://avatars.githubusercontent.com/u/241859342?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/241859342?s=400&v=4
og:image:altFixes #880 Problem: When the retry mechanism re-raises non-retryable exceptions, it explicitly clears the exception chain by using raise final_exc from None. This breaks explicit exception chaining...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/googleapis/python-api-core git https://github.com/googleapis/python-api-core.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id226992456
octolytics-dimension-repository_nwogoogleapis/python-api-core
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id226992456
octolytics-dimension-repository_network_root_nwogoogleapis/python-api-core
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9fabff9b8b127e686a3ec86f91422e818056ca2c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/python-api-core/pull/879/changes#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F879%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F879%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=googleapis%2Fpython-api-core
Reloadhttps://github.com/googleapis/python-api-core/pull/879/changes
Reloadhttps://github.com/googleapis/python-api-core/pull/879/changes
Reloadhttps://github.com/googleapis/python-api-core/pull/879/changes
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/879/changes
googleapis https://github.com/googleapis
python-api-corehttps://github.com/googleapis/python-api-core
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Fork 97 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Star 144 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Code https://github.com/googleapis/python-api-core
Issues 0 https://github.com/googleapis/python-api-core/issues
Pull requests 0 https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality 0 https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
Code https://github.com/googleapis/python-api-core
Issues https://github.com/googleapis/python-api-core/issues
Pull requests https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
partheahttps://github.com/parthea
googleapis:mainhttps://github.com/googleapis/python-api-core/tree/main
fercor-cisco:fernandocorreia/exception-chainhttps://github.com/fercor-cisco/python-api-core/tree/fernandocorreia/exception-chain
Conversation 9 https://github.com/googleapis/python-api-core/pull/879
Commits 2 https://github.com/googleapis/python-api-core/pull/879/commits
Checks 18 https://github.com/googleapis/python-api-core/pull/879/checks
Files changed 2 https://github.com/googleapis/python-api-core/pull/879/files
fix: preserve exception cause https://github.com/googleapis/python-api-core/pull/879/changes#top
Show all changes 2 commits https://github.com/googleapis/python-api-core/pull/879/files
6d54303 fix: preserve exception cause fercor-cisco Dec 20, 2025 https://github.com/googleapis/python-api-core/pull/879/commits/6d543035a8bbf8a12e097157e2a731e479509b3c
e64a943 Fix lint issue fercor-cisco Jan 9, 2026 https://github.com/googleapis/python-api-core/pull/879/commits/e64a94397be54f854e2644fbabba03ec62fdb007
Clear filters https://github.com/googleapis/python-api-core/pull/879/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/879/changes
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/879/changes
retry_base.py https://github.com/googleapis/python-api-core/pull/879/changes#diff-0c2b34f85d94509a7f96f3a5645a00654223d9f3657ca7d687264fcc9b81f522
test_retry_base.py https://github.com/googleapis/python-api-core/pull/879/changes#diff-4bd2dfd3270f206ce10cdab2fbc438e4467dd82d55df7a2daa7e1c59029f101f
google/api_core/retry/retry_base.pyhttps://github.com/googleapis/python-api-core/pull/879/changes#diff-0c2b34f85d94509a7f96f3a5645a00654223d9f3657ca7d687264fcc9b81f522
View file https://github.com/fercor-cisco/python-api-core/blob/e64a94397be54f854e2644fbabba03ec62fdb007/google/api_core/retry/retry_base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/879/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/879/changes#diff-0c2b34f85d94509a7f96f3a5645a00654223d9f3657ca7d687264fcc9b81f522
https://github.com/googleapis/python-api-core/pull/879/changes#diff-0c2b34f85d94509a7f96f3a5645a00654223d9f3657ca7d687264fcc9b81f522
tests/unit/retry/test_retry_base.pyhttps://github.com/googleapis/python-api-core/pull/879/changes#diff-4bd2dfd3270f206ce10cdab2fbc438e4467dd82d55df7a2daa7e1c59029f101f
View file https://github.com/fercor-cisco/python-api-core/blob/e64a94397be54f854e2644fbabba03ec62fdb007/tests/unit/retry/test_retry_base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/879/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/879/changes#diff-4bd2dfd3270f206ce10cdab2fbc438e4467dd82d55df7a2daa7e1c59029f101f
https://github.com/googleapis/python-api-core/pull/879/changes#diff-4bd2dfd3270f206ce10cdab2fbc438e4467dd82d55df7a2daa7e1c59029f101f
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/879/changes
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.