metebalci / pdftitle

a utility to extract the title from a PDF file
GNU General Public License v3.0
131 stars 21 forks source link

raise Exception cause app crash #36

Open celikbas opened 1 year ago

celikbas commented 1 year ago

is it possible to create an informative error message instead of application crash.

Traceback (most recent call last):
  File "/home/zk/.local/lib/python3.9/site-packages/pdftitle.py", line 701, in run
    title = get_title_from_file(args.pdf)
  File "/home/zk/.local/lib/python3.9/site-packages/pdftitle.py", line 581, in get_title_from_file
    return get_title_from_io(raw_file)
  File "/home/zk/.local/lib/python3.9/site-packages/pdftitle.py", line 476, in get_title_from_io
    dev.recover_last_paragraph()
  File "/home/zk/.local/lib/python3.9/site-packages/pdftitle.py", line 341, in recover_last_paragraph
    raise Exception("current block is None, this might be a bug. " +
Exception: current block is None, this might be a bug. please report it together with the pdf file
metebalci commented 1 year ago

Can you share the pdf file causing this ?

celikbas commented 1 year ago

Sorry, I couldn't anonymize the pdf. But can I ask you to provide an option to rise an error message instead of crash.

metebalci commented 1 year ago

You can tell me the title etc. I might be able to find the pdf. The error indicates this is not supposed to happen, so I have to check why it happens first. The unexpected errors are reported like this for the moment.

user202729 commented 9 months ago

One possible PDF that causes this error is https://www.ams.org/about-us/6.14_LivingProof.pdf .