Skip to content

Conversation

chilledgeek
Copy link
Contributor

closes #1200

Story:

  • Would be good to have clearer distinction of some well defined errors (that we want to detect) from the generic PdfReadError:
    • WrongPasswordError
    • FileNotDecryptedError
    • EmptyFileError
  • This makes it cleaner for error catching and handling (instead of inspecting the args within the error message)

@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #1201 (1e53be0) into main (4aa9ec9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1201   +/-   ##
=======================================
  Coverage   92.14%   92.15%           
=======================================
  Files          24       24           
  Lines        4939     4945    +6     
  Branches     1021     1024    +3     
=======================================
+ Hits         4551     4557    +6     
  Misses        244      244           
  Partials      144      144           
Impacted Files Coverage Δ
PyPDF2/_reader.py 90.32% <100.00%> (ø)
PyPDF2/errors.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

@MartinThoma
Copy link
Member

Makes sense to me! I'll review it after work (hopefully... It's crazy hot)

Copy link
Member

@MartinThoma MartinThoma left a comment

Choose a reason for hiding this comment

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

Thank you for this PR!

There are two minor comments in test_reader.py - besides that, it's good to go 🎉

@chilledgeek
Copy link
Contributor Author

Thank you for this PR!

There are two minor comments in test_reader.py - besides that, it's good to go 🎉

addressed. thanks

@chilledgeek chilledgeek requested a review from MartinThoma August 4, 2022 18:11
Copy link
Member

@MartinThoma MartinThoma left a comment

Choose a reason for hiding this comment

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

Very nice! Thank you :-)

@MartinThoma MartinThoma changed the title Clearer distinction of some well defined errors MAINT: Introduce WrongPasswordError / FileNotDecryptedError / EmptyFileError Aug 4, 2022
@MartinThoma MartinThoma merged commit d0a058a into py-pdf:main Aug 4, 2022
@MartinThoma
Copy link
Member

The PR is merged and will be part of the release on Sunday. Thank you 🤗

@MartinThoma
Copy link
Member

If you want, I can add you to https://pypdf2.readthedocs.io/en/latest/meta/CONTRIBUTORS.html . Just let me know which line I should use:

* Last name, First name: 140-characters of text; links to linkedin / github / other profiles and personal pages are ok

OR

* GitHub Username: 140-characters of text; links to linkedin / github / other profiles and personal pages are ok

@chilledgeek
Copy link
Contributor Author

If you want, I can add you to https://pypdf2.readthedocs.io/en/latest/meta/CONTRIBUTORS.html . Just let me know which line I should use:

* Last name, First name: 140-characters of text; links to linkedin / github / other profiles and personal pages are ok

OR

* GitHub Username: 140-characters of text; links to linkedin / github / other profiles and personal pages are ok

Thank you @MartinThoma! I'll go with this:

* [chilledgeek](https://github.com/chilledgeek): loves open source! [linkedIn](www.linkedin.com/in/ernchow) | [blog](https://www.blog.chilledgeek.com/)

@chilledgeek chilledgeek deleted the clearer-exception-classes branch August 4, 2022 21:39
MartinThoma added a commit that referenced this pull request Aug 7, 2022
New Features (ENH):
-  "with" support for PdfMerger and PdfWriter (#1193)
-  Add AnnotationBuilder.text(...) to build text annotations (#1202)

Bug Fixes (BUG):
-  Allow IndirectObjects as stream filters (#1211)

Documentation (DOC):
-  Font scrambling
-  Page vs Content scaling (#1208)
-  Example for orientation parameter of extract_text (#1206)
-  Fix AnnotationBuilder parameter formatting (#1204)

Developer Experience (DEV):
-  Add flake8-print (#1203)

Maintenance (MAINT):
-  Introduce WrongPasswordError / FileNotDecryptedError / EmptyFileError  (#1201)

Full Changelog: 2.9.0...2.10.0
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.

Clearer distinction of some well defined errors
2 participants