Просмотр исходного кода

Merge pull request #9011 from overleaf/jpa-better-render-error-message

[web] provide helpful error message when pdf rendering fails

GitOrigin-RevId: abbe6f362fa362fadee197527463ee675760e581
Jakob Ackermann 4 лет назад
Родитель
Сommit
315414de1b

+ 8 - 0
services/web/frontend/js/features/pdf-preview/components/pdf-preview-error.js

@@ -16,6 +16,14 @@ function PdfPreviewError({ error }) {
       return (
         <ErrorLogEntry title={t('pdf_rendering_error')}>
           {t('something_went_wrong_rendering_pdf')}
+          &nbsp;
+          <Trans
+            i18nKey="try_recompile_project_or_troubleshoot"
+            components={[
+              // eslint-disable-next-line react/jsx-key, jsx-a11y/anchor-has-content
+              <a href="/learn/how-to/Resolving_access%2C_loading%2C_and_display_problems" />,
+            ]}
+          />
         </ErrorLogEntry>
       )
 

+ 8 - 2
services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx

@@ -557,7 +557,10 @@ describe('<PdfPreview/>', function () {
 
       cy.wait('@compile-pdf-error')
 
-      cy.findByText('Something went wrong while rendering this PDF.')
+      cy.contains('Something went wrong while rendering this PDF.')
+      cy.contains(
+        'Please try recompiling the project from scratch, and if that doesn’t help, follow our troubleshooting guide.'
+      )
       cy.findByLabelText('Page 1').should('not.exist')
     })
 
@@ -578,7 +581,10 @@ describe('<PdfPreview/>', function () {
 
       cy.wait('@compile-pdf-corrupt')
 
-      cy.findByText('Something went wrong while rendering this PDF.')
+      cy.contains('Something went wrong while rendering this PDF.')
+      cy.contains(
+        'Please try recompiling the project from scratch, and if that doesn’t help, follow our troubleshooting guide.'
+      )
       cy.findByLabelText('Page 1').should('not.exist')
     })
   })