void debug_pages(vector<page *> &pages)
{
- if (!debug_mode)
+ if (!debug_level)
return;
for (auto pg: pages)
{
debug("# Executing %s", c->def->name);
debug_indent += 4;
- pages = c->exec->process(pages);
+ try
+ {
+ pages = c->exec->process(pages);
+ }
+ catch (exception &e)
+ {
+ die("Error in %s: %s", c->def->name, e.what());
+ }
debug_indent -= 4;
debug_pages(pages);
}
void process(list<cmd *> &cmds)
{
+ debug("### Reading input");
in_pdf.processFile(in_name);
in_pdf.pushInheritedAttributesToPage();
out_pdf.emptyPDF();
if (recalc_bbox)
do_recalc_bbox(pages, in_name);
+ debug("### Running commands");
pages = run_command_list(cmds, pages);
+ debug("### Writing output");
for (auto pg: pages)
{
out_context out;
// Write the output file
QPDFWriter writer(out_pdf, out_name);
writer.write();
+ debug("### Done");
}
/*** Re-calculation of bboxes ***/