Get more information from podofo exceptions

This commit is contained in:
Kovid Goyal 2019-07-24 19:51:33 +05:30
parent 23766d6b83
commit c84d019ef7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -9,10 +9,16 @@
using namespace pdf;
void pdf::podofo_set_exception(const PdfError &err) {
void
pdf::podofo_set_exception(const PdfError &err) {
const char *msg = PdfError::ErrorMessage(err.GetError());
if (msg == NULL) msg = err.what();
PyErr_SetString(Error, msg);
std::stringstream stream;
stream << msg << "\n";
for (auto &info : err.GetCallstack()) {
stream << "File: " << info.GetFilename() << "Line: " << info.GetLine() << " " << info.GetInformation() << "\n";
}
PyErr_SetString(Error, stream.str().c_str());
}
PyObject *