Hi,
The documentation is not clear about how to handle errors. Although there is this here PDF.js Express Viewer Events | Documentation (pdfjs.express), this call is never triggered as per my tests.
Example:
- Setup the WebViewer as per the docs above
- Subscribe to the loaderror event
- Pass in a wrong url to the parameter
initialDoc
. This returns a 404 error in the network
The loaderror callback is never called.
I also tried adding a .catch() function to the Promise, but that was not called back either.
Can someone pls provide some guidance about how to handle errors? Here what I have tried:
documentViewer.addEventListener('loaderror', () => {
debugger // never get called
})
And also this
WebViewer({
path: this.path,
initialDoc: this.url,
licenseKey: process.env.VUE_APP_PDFJS_KEY
}, pdfViewer).then((instance) => {
...
});
}).catch(() => {
debugger // never gets called
})
Thx