magicbookproject / magicbook

The magic book project returns!
MIT License
1.07k stars 59 forks source link

More detailed PrinceXML error messages #7

Closed shiffman closed 8 years ago

shiffman commented 8 years ago

I'm trying to get more detail about a PrinceXML error. What about a "verbose" build argument to grab the output of callback(error)?

      Prince()
        .inputs(path.join(extras.destination, "consolidated.html"))
        .output(path.join(extras.destination, "consolidated.pdf"))
        .execute()
        .then(function () {
          callback(null, config, stream, extras);
        }, function (error) {
          console.log("Prince XML error")
          callback(error);
        });
    });

https://github.com/magicbookproject/magicbook/blob/d4c271f0fa8bc37fa87963421268e84c1b053107/src/plugins/pdf.js#L46

shiffman commented 8 years ago

I noticed that the error messages can be insanely long if one thing is out of place. I am dealing with this by writing the error to a file to examine, this might be a good option too.

runemadsen commented 8 years ago

Great idea. I'm going to add this today.

runemadsen commented 8 years ago

Okay, this has been fixed in 0.1.4. You can now add the following to your config file:

"pdf" : {
  "log" : "mylog.txt"
}

And each build will have a mylog.txt file with the Prince log.