Skip to content

Commit 5bf58dc

Browse files
committed
add debug
1 parent 6b7d4c0 commit 5bf58dc

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pdf-bot",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"author": "Esben Petersen <[email protected]>",
55
"homepage": "https://github.com/esbenp/pdf-bot",
66
"license": "MIT",

src/pdfGenerator.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function createPdfGenerator(storagePath, options = {}, storagePlugins = {}) {
1212

1313
var generationId = uuid()
1414
var generated_at = utils.getCurrentDateTimeAsString()
15+
var jobId = job.id
1516

1617
function createResponseObject() {
1718
return {
@@ -73,7 +74,7 @@ function createPdfGenerator(storagePath, options = {}, storagePlugins = {}) {
7374
.catch(msg => {
7475
var response = error.createErrorResponse(error.ERROR_HTML_PDF_CHROME_ERROR)
7576

76-
response.message += ' ' + msg
77+
response.message += ' ' + msg + ' (job ID: ' + jobId + '. Generation ID: ' + generationId + ')'
7778

7879
return Object.assign(createResponseObject(), response)
7980
})

test/pdfGenerator.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ describe('PDF Generator', function() {
2424

2525
it('should call html-pdf-chrome with the correct options', function() {
2626
var options = {options: true}
27-
generator = createGenerator('storage', options)('url')
27+
generator = createGenerator('storage', options)('url', {id: 1})
2828

2929
if (!createStub.calledOnce || !createStub.calledWith('url', options)) {
3030
throw new Error('Correct options not passed')
3131
}
3232
})
3333

3434
it('should attempt to write pdf to storage', function(done) {
35-
generator('url').then(() => {
35+
generator('url', {id: 1}).then(() => {
3636
if (!pdf.toFile.calledOnce || !pdf.toFile.args[0][0].match(/storage\/pdf\/(.+)\.pdf$/)) {
3737
throw new Error('PDF was not attempted to saved')
3838
}
@@ -51,7 +51,7 @@ describe('PDF Generator', function() {
5151
}
5252
}
5353

54-
createGenerator('storage', {}, storage)('url').then(response => {
54+
createGenerator('storage', {}, storage)('url', {id: 1}).then(response => {
5555
var storage = response.storage
5656

5757
if (storage.storage_1.path !== 'file_1' || storage.storage_2.path !== 'file_2') {
@@ -65,7 +65,7 @@ describe('PDF Generator', function() {
6565
it('should return error response thrown promises', function(done) {
6666
createStub.onCall(0).returns(new Promise((resolve, reject) => reject('error')))
6767

68-
createGenerator('storage', {}, {})('url').then(response => {
68+
createGenerator('storage', {}, {})('url', {id: 1}).then(response => {
6969
if (!error.isError(response)) {
7070
throw new Exception('Generator rejection did not resolve in error promise')
7171
}

0 commit comments

Comments
 (0)