error is undefinied from OnError($event)

- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request

Hello, I don’t know if this behavior is normal but I’m having trouble getting details of an (intentional) error
here is my PDF viewer in HTML

  style="display: block;"

and here is the onError function in the .TS

onError(errorPDF: any){console.log(errorPDF)}

the url of the pdf request returns a 404 error (as intended in my EXPRESS api )

res.status(404).send({ error: 'Not Found' });

In the chrome console i only get an ‘undefined’ for the ‘console.log (error PDF)’
Is it normal? Is there a way to get the code error thanks to the ‘OnError’ function?


1 possible answer(s) on “error is undefinied from OnError($event)

  1. Found it. The error message is a victim of minification. If you’re using the non-minified version of the pdf.worker.js, the error object has a sensible value. In my case, I’ve added this line to the app.module.ts:

    (window as any).pdfWorkerSrc = '';