From c84d019ef7d5a40338530c203d6fec8497ff11cd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Jul 2019 19:51:33 +0530 Subject: [PATCH] Get more information from podofo exceptions --- src/calibre/utils/podofo/utils.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/podofo/utils.cpp b/src/calibre/utils/podofo/utils.cpp index dd934b7f3d..a8755278cb 100644 --- a/src/calibre/utils/podofo/utils.cpp +++ b/src/calibre/utils/podofo/utils.cpp @@ -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 *