Open awesomeunleashed opened 5 years ago
This is an interesting idea for v2.
My thought was that once an error occurs, the PDF import typically cannot continue, so the importer simply panics. If the importer were to return errors instead, the importer might need a flag saying if an error had occurred, in case more Importer functions are called. After that point the importer would always return an error, saying something like "Cannot continue due to previous error".
Please feel free to discuss how you think this should work.
My main thoughts on that reasoning:
Personally, as a consumer, I'd be happy if the only change was to change the places where the Importer panics an error to return that error instead (which would be a simple, if breaking, change).
This seemed like a strange choice to me, as Go libraries generally return errors instead of panicking. I would like to use the Importer to import PDFs submitted to my API, but as it stands I'm going to have to recover any panics caused by bad PDF formatting so that I can inform the caller of the issue. Any thoughts on this? Would you be opposed to a v2 that returns errors instead?