@@ -728,7 +728,7 @@ const PDFViewerApplication = {
728
728
"An error occurred while loading the PDF."
729
729
)
730
730
. then ( msg => {
731
- PDFViewerApplication . error ( msg , err ) ;
731
+ PDFViewerApplication . _documentError ( msg , err ) ;
732
732
} ) ;
733
733
} ,
734
734
onProgress ( loaded , total ) {
@@ -812,6 +812,8 @@ const PDFViewerApplication = {
812
812
* destruction is completed.
813
813
*/
814
814
async close ( ) {
815
+ this . _unblockDocumentLoadEvent ( ) ;
816
+
815
817
const errorWrapper = this . appConfig . errorWrapper . container ;
816
818
errorWrapper . setAttribute ( "hidden" , "true" ) ;
817
819
@@ -943,8 +945,6 @@ const PDFViewerApplication = {
943
945
this . load ( pdfDocument ) ;
944
946
} ,
945
947
exception => {
946
- this . _unblockDocumentLoadEvent ( ) ;
947
-
948
948
if ( loadingTask !== this . pdfLoadingTask ) {
949
949
return undefined ; // Ignore errors for previously opened PDF files.
950
950
}
@@ -980,7 +980,7 @@ const PDFViewerApplication = {
980
980
}
981
981
982
982
return loadingErrorMessage . then ( msg => {
983
- this . error ( msg , { message } ) ;
983
+ this . _documentError ( msg , { message } ) ;
984
984
throw exception ;
985
985
} ) ;
986
986
}
@@ -1114,13 +1114,24 @@ const PDFViewerApplication = {
1114
1114
} ,
1115
1115
1116
1116
/**
1117
- * Show the error box.
1117
+ * Show the error box; used for errors affecting loading and/or parsing of
1118
+ * the entire PDF document.
1119
+ */
1120
+ _documentError ( message , moreInfo = null ) {
1121
+ this . _unblockDocumentLoadEvent ( ) ;
1122
+
1123
+ this . _otherError ( message , moreInfo ) ;
1124
+ } ,
1125
+
1126
+ /**
1127
+ * Show the error box; used for errors affecting e.g. only a single page.
1128
+ *
1118
1129
* @param {string } message - A message that is human readable.
1119
1130
* @param {Object } [moreInfo] - Further information about the error that is
1120
1131
* more technical. Should have a 'message' and
1121
1132
* optionally a 'stack' property.
1122
1133
*/
1123
- error ( message , moreInfo ) {
1134
+ _otherError ( message , moreInfo = null ) {
1124
1135
const moreInfoText = [
1125
1136
this . l10n . get (
1126
1137
"error_version_info" ,
@@ -2051,7 +2062,7 @@ const PDFViewerApplication = {
2051
2062
"Warning: Printing is not fully supported by this browser."
2052
2063
)
2053
2064
. then ( printMessage => {
2054
- this . error ( printMessage ) ;
2065
+ this . _otherError ( printMessage ) ;
2055
2066
} ) ;
2056
2067
return ;
2057
2068
}
@@ -2392,7 +2403,7 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
2392
2403
PDFViewerApplication . l10n
2393
2404
. get ( "loading_error" , null , "An error occurred while loading the PDF." )
2394
2405
. then ( loadingErrorMessage => {
2395
- PDFViewerApplication . error ( loadingErrorMessage , {
2406
+ PDFViewerApplication . _documentError ( loadingErrorMessage , {
2396
2407
message : ex ?. message ,
2397
2408
} ) ;
2398
2409
} ) ;
@@ -2545,7 +2556,7 @@ function webViewerInitialized() {
2545
2556
PDFViewerApplication . l10n
2546
2557
. get ( "loading_error" , null , "An error occurred while loading the PDF." )
2547
2558
. then ( msg => {
2548
- PDFViewerApplication . error ( msg , reason ) ;
2559
+ PDFViewerApplication . _documentError ( msg , reason ) ;
2549
2560
} ) ;
2550
2561
}
2551
2562
}
@@ -2622,7 +2633,7 @@ function webViewerPageRendered({ pageNumber, timestamp, error }) {
2622
2633
"An error occurred while rendering the page."
2623
2634
)
2624
2635
. then ( msg => {
2625
- PDFViewerApplication . error ( msg , error ) ;
2636
+ PDFViewerApplication . _otherError ( msg , error ) ;
2626
2637
} ) ;
2627
2638
}
2628
2639
0 commit comments