Comparing version 1.12.0 to 1.13.0
{ | ||
"name": "btrz-pdf", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"description": "Generates pdf documents based on a liquid template", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -87,5 +87,10 @@ const {Liquid} = require("liquidjs"); | ||
// console.log(str); | ||
return JSON.parse(str); | ||
try { | ||
return JSON.parse(str); | ||
} catch (err) { | ||
err.data = str; | ||
throw err; | ||
} | ||
}, | ||
defaultDocumentDefinition | ||
}; |
@@ -321,2 +321,20 @@ describe("index.js", () => { | ||
it("should return the error JSON in the err.data property", async () => { | ||
const pdf = require("../src/index"); | ||
const template = `{ | ||
"content": [{}, | ||
] | ||
}`; | ||
try { | ||
const documentDefinition = await pdf.toDocumentDefinition(template, data); | ||
expect(1).to.be.eql(2); | ||
} catch (err) { | ||
//spaces are important in this test | ||
expect(err.data).to.be.eql(`{ | ||
"content": [{}, | ||
] | ||
}`); | ||
} | ||
}); | ||
it("should parse dates from ISO dates", async () => { | ||
@@ -323,0 +341,0 @@ const pdf = require("../src/index"); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62109
1287