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

Error handling for non-PDFs #178

Closed
3 tasks done
dreua opened this issue Apr 15, 2020 · 0 comments
Closed
3 tasks done

Error handling for non-PDFs #178

dreua opened this issue Apr 15, 2020 · 0 comments

Comments

@dreua
Copy link
Member

dreua commented Apr 15, 2020

When opening a file that is broken or not a PDF at all, the following error gets printed to command line:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/pdfarranger/pdfarranger.py", line 928, in sw_dnd_received_data
    msg = pageadder.addpages(filename)
  File "/usr/lib/python3.7/site-packages/pdfarranger/pdfarranger.py", line 1210, in addpages
    pdfdoc = PDFDoc(filename, self.app.tmp_dir)
  File "/usr/lib/python3.7/site-packages/pdfarranger/pdfarranger.py", line 1177, in __init__
    self.document = Poppler.Document.new_from_file(uri, None)
gi.repository.GLib.Error: poppler-quark: PDF document is damaged (4)

This is confusing to users (if they see it at all) and additionally this triggers Fedora's automatic bug reporting tool (ABRT).
Note that this can be triggered via drag & drop, by command line argument and by the "add file" button. (In the last case, a warning dialog is shown.)

Originally reported by Fedora user sukhamay ganguly (bug not publicly visible) who tried to open a picture in pdfarranger (which is a fair thing to do imo, see #45)

Solution

Show a proper warning dialog and print a user and abrt friendly message to the console in all three possible ways to add a file:

  • Drag and Drop
  • Add file
  • Command line argument (alternatively don't show gui at all, print only to console and exit)

Related: #101 / 53cc05f

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

No branches or pull requests

2 participants