Catch all exceptions when altering links

This commit is contained in:
Kovid Goyal 2019-09-04 21:01:55 +05:30
parent 8d0f0cef93
commit 7f1519989f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -511,6 +511,12 @@ PDFDoc_alter_links(PDFDoc *self, PyObject *args) {
} catch(const PdfError & err) {
podofo_set_exception(err);
return NULL;
} catch(const std::exception & err) {
PyErr_Format(PyExc_ValueError, "An error occurred while trying to alter links: %s", err.what());
return NULL;
} catch (...) {
PyErr_SetString(PyExc_ValueError, "An unknown error occurred while trying to alter links");
return NULL;
}
return Py_BuildValue("i", count);
} // }}}