nbesli/pdf-merger-js

Error: already ended

j33l opened this issue · 3 comments

j33l commented
(node:4676) UnhandledPromiseRejectionWarning: Error: already ended
    at Object.<anonymous> (...api\node_modules\pdfjs\lib\fragment.js:10:29)        
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (...api\node_modules\pdfjs\lib\document.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
(node:4676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What this error means ?
and how to prevent it?

j33l commented

Ok, So i was using the same var merger = new PDFMerger() for every time i merge PDFs.
When i created new instances of PDFMerger, the problem Error: already ended was gone.
Hope developers will document this modules properly.

Thanks for reporting this. This should be fixed or at least be better documented.

Thanks for figuring this!