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

Fixing misleading failure message in pmc_to_pdf #71

Merged
merged 2 commits into from
Apr 9, 2024

Conversation

jamesbraza
Copy link
Collaborator

https://github.com/blackadad/paper-scraper/actions/runs/8619716170/attempts/1?pr=69

E               RuntimeError: No paper with pmc id 8971931. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8971931 403

This message is misleading because the issue was a 403, not that there's "no paper".

This PR:

  • Moves to properly chaining stack traces in pmc_to_pdf
  • Type hints related functions

@jamesbraza jamesbraza added the bug Something isn't working label Apr 9, 2024
@jamesbraza jamesbraza requested review from mskarlin and blackadad April 9, 2024 17:56
@jamesbraza jamesbraza self-assigned this Apr 9, 2024
Copy link
Collaborator

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

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

👍

@jamesbraza jamesbraza merged commit 45556ff into main Apr 9, 2024
1 check failed
@jamesbraza jamesbraza deleted the better-pmc-to-pdf-failure branch April 9, 2024 18:47
jamesbraza added a commit that referenced this pull request Apr 9, 2024
pdf_url = await find_pmc_pdf_link(pmc_id, session)
async with session.get(pdf_url, allow_redirects=True) as r:
if not r.ok or not await likely_pdf(r):
exc: Exception | None = None
with contextlib.suppress(ClientResponseError):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was a ruff mix up here with SIM105, fixed in #72

jamesbraza added a commit that referenced this pull request Apr 9, 2024
* Fixed accidental SIM105 during commit of #71

* Allowing exception through find_pmc_pdf_link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants