From bf952e134f2a04a78995b46a7238cf99bd9bcb24 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Thu, 23 Apr 2020 07:51:16 -0400 Subject: [PATCH] Merge pull request #2762 from overleaf/as-prevent-missing-pdf-exception Prevent Sentry from reporting "expected" MissingPDFException GitOrigin-RevId: 4a6da75bcb3710df7b3be71005d57160e609b0d4 --- .../js/ide/pdfng/directives/pdfViewer.js | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/services/web/frontend/js/ide/pdfng/directives/pdfViewer.js b/services/web/frontend/js/ide/pdfng/directives/pdfViewer.js index a9eb1e6fb7..07a2dc7e35 100644 --- a/services/web/frontend/js/ide/pdfng/directives/pdfViewer.js +++ b/services/web/frontend/js/ide/pdfng/directives/pdfViewer.js @@ -79,9 +79,17 @@ define([ return $scope.$emit('loaded') }, errorCallback(error) { - __guardMethod__(window.Raven, 'captureMessage', o => - o.captureMessage(`pdfng error ${error}`) - ) + if (window.Raven) { + // MissingPDFException is "expected" as the pdf file can be on a + // CLSI server that has been cycled out. + // Currently, there is NO error handling to handle this situation, + // but we plan to add this in the future + // (https://github.com/overleaf/issues/issues/2985) and this error + // is causing noise in Sentry so ignore it + if (!error.name === 'MissingPDFException') { + window.Raven.captureMessage(`pdfng error ${error}`) + } + } return $scope.$emit('pdf:error', error) }, pageSizeChangeCallback(pageNum, deltaH) { @@ -850,17 +858,6 @@ define([ })) }) -function __guardMethod__(obj, methodName, transform) { - if ( - typeof obj !== 'undefined' && - obj !== null && - typeof obj[methodName] === 'function' - ) { - return transform(obj, methodName) - } else { - return undefined - } -} function __range__(left, right, inclusive) { let range = [] let ascending = left < right