#PDF File Reading In GoLang

13 messages · Page 1 of 1 (latest)

nimble zenith
#

I have written a completely working function that reads PDF Files and scans images for text using an external OCR Library.
I am using fitz to read data from each page as html and bluemonday to parse the html.
There is a weird panic being caused while reading a certain test pdf file (error messages attached)
Is there a way to simply skip execution and return nothing if the function panics? (im not talking about if err != nil checks that happen within the function)
I need a way to return something from my pdf read function in case it panics.

cunning scarab
nimble zenith
#

nope, every single error is being checked for not nil

#

and there is a return "", err if it is not nil

#

im trying to send my code but im unable to

cunning scarab
nimble zenith
#

here

cunning scarab
#

Dunno, could be that whoever wrote the library just decided to panic sometimes instead of returning error

nimble zenith
#

is there a way for me to handle it?

#

like no matter what goes down just dont panic

#

something like a try catch

nimble zenith
#

could someone help me with this?