Report filtered pdf.js errors to Sentry (#5438)

GitOrigin-RevId: 7ab5a6fd61d271037ee33bbeadfad00b389812d6
This commit is contained in:
Alf Eaton 2021-10-15 10:51:27 +01:00 committed by Copybot
parent 4c25dcfb2b
commit 7f5200da8c

View file

@ -5,6 +5,7 @@ import * as PDFJSViewer from 'pdfjs-dist/legacy/web/pdf_viewer'
import PDFJSWorker from 'pdfjs-dist/legacy/build/pdf.worker'
import 'pdfjs-dist/legacy/web/pdf_viewer.css'
import getMeta from '../../../utils/meta'
import { captureMessage } from '../../../infrastructure/error-reporter'
if (typeof window !== 'undefined' && 'Worker' in window) {
PDFJS.GlobalWorkerOptions.workerPort = new PDFJSWorker()
@ -89,6 +90,10 @@ export default class PDFJSWrapper {
})
.catch(error => {
if (this.loadDocumentTask) {
if (error.name !== 'MissingPDFException') {
captureMessage(`pdf preview error ${error}`)
}
reject(error)
}
})