Merge pull request #15538 from Snuffleupagus/viewer-error-logging
Stop localizing error *details* in the viewer (PR 15533 follow-up)
This commit is contained in:
commit
8629a55215
@ -197,21 +197,6 @@ find_match_count_limit[many]=More than {{limit}} matches
|
|||||||
find_match_count_limit[other]=More than {{limit}} matches
|
find_match_count_limit[other]=More than {{limit}} matches
|
||||||
find_not_found=Phrase not found
|
find_not_found=Phrase not found
|
||||||
|
|
||||||
# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
|
|
||||||
# replaced by the PDF.JS version and build ID.
|
|
||||||
error_version_info=PDF.js v{{version}} (build: {{build}})
|
|
||||||
# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
|
|
||||||
# english string describing the error.
|
|
||||||
error_message=Message: {{message}}
|
|
||||||
# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
|
|
||||||
# trace.
|
|
||||||
error_stack=Stack: {{stack}}
|
|
||||||
# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
|
|
||||||
error_file=File: {{file}}
|
|
||||||
# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
|
|
||||||
error_line=Line: {{line}}
|
|
||||||
rendering_error=An error occurred while rendering the page.
|
|
||||||
|
|
||||||
# Predefined zoom values
|
# Predefined zoom values
|
||||||
page_scale_width=Page Width
|
page_scale_width=Page Width
|
||||||
page_scale_fit=Page Fit
|
page_scale_fit=Page Fit
|
||||||
@ -227,6 +212,7 @@ loading_error=An error occurred while loading the PDF.
|
|||||||
invalid_file_error=Invalid or corrupted PDF file.
|
invalid_file_error=Invalid or corrupted PDF file.
|
||||||
missing_file_error=Missing PDF file.
|
missing_file_error=Missing PDF file.
|
||||||
unexpected_response_error=Unexpected server response.
|
unexpected_response_error=Unexpected server response.
|
||||||
|
rendering_error=An error occurred while rendering the page.
|
||||||
|
|
||||||
# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
|
# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
|
||||||
# replaced by the modification date, and time, of the annotation.
|
# replaced by the modification date, and time, of the annotation.
|
||||||
|
37
web/app.js
37
web/app.js
@ -1057,7 +1057,7 @@ const PDFViewerApplication = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the error box; used for errors affecting loading and/or parsing of
|
* Report the error; used for errors affecting loading and/or parsing of
|
||||||
* the entire PDF document.
|
* the entire PDF document.
|
||||||
*/
|
*/
|
||||||
_documentError(message, moreInfo = null) {
|
_documentError(message, moreInfo = null) {
|
||||||
@ -1073,45 +1073,30 @@ const PDFViewerApplication = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the error box; used for errors affecting e.g. only a single page.
|
* Report the error; used for errors affecting e.g. only a single page.
|
||||||
*
|
|
||||||
* @param {string} message - A message that is human readable.
|
* @param {string} message - A message that is human readable.
|
||||||
* @param {Object} [moreInfo] - Further information about the error that is
|
* @param {Object} [moreInfo] - Further information about the error that is
|
||||||
* more technical. Should have a 'message' and
|
* more technical. Should have a 'message' and
|
||||||
* optionally a 'stack' property.
|
* optionally a 'stack' property.
|
||||||
*/
|
*/
|
||||||
_otherError(message, moreInfo = null) {
|
_otherError(message, moreInfo = null) {
|
||||||
const moreInfoText = [
|
const moreInfoText = [`PDF.js v${version || "?"} (build: ${build || "?"})`];
|
||||||
this.l10n.get("error_version_info", {
|
|
||||||
version: version || "?",
|
|
||||||
build: build || "?",
|
|
||||||
}),
|
|
||||||
];
|
|
||||||
if (moreInfo) {
|
if (moreInfo) {
|
||||||
moreInfoText.push(
|
moreInfoText.push(`Message: ${moreInfo.message}`);
|
||||||
this.l10n.get("error_message", { message: moreInfo.message })
|
|
||||||
);
|
|
||||||
if (moreInfo.stack) {
|
if (moreInfo.stack) {
|
||||||
moreInfoText.push(
|
moreInfoText.push(`Stack: ${moreInfo.stack}`);
|
||||||
this.l10n.get("error_stack", { stack: moreInfo.stack })
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
if (moreInfo.filename) {
|
if (moreInfo.filename) {
|
||||||
moreInfoText.push(
|
moreInfoText.push(`File: ${moreInfo.filename}`);
|
||||||
this.l10n.get("error_file", { file: moreInfo.filename })
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (moreInfo.lineNumber) {
|
if (moreInfo.lineNumber) {
|
||||||
moreInfoText.push(
|
moreInfoText.push(`Line: ${moreInfo.lineNumber}`);
|
||||||
this.l10n.get("error_line", { line: moreInfo.lineNumber })
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(moreInfoText).then(parts => {
|
console.error(`${message}\n\n${moreInfoText.join("\n")}`);
|
||||||
console.error(`${message}\n${parts.join("\n")}`);
|
|
||||||
});
|
|
||||||
this.fallback();
|
this.fallback();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1481,7 +1466,7 @@ const PDFViewerApplication = {
|
|||||||
console.log(
|
console.log(
|
||||||
`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
|
`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
|
||||||
`${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` +
|
`${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` +
|
||||||
`(PDF.js: ${version || "-"})`
|
`(PDF.js: ${version || "?"} [${build || "?"}])`
|
||||||
);
|
);
|
||||||
let pdfTitle = info.Title;
|
let pdfTitle = info.Title;
|
||||||
|
|
||||||
|
@ -51,13 +51,6 @@ const DEFAULT_L10N_STRINGS = {
|
|||||||
"find_match_count_limit[other]": "More than {{limit}} matches",
|
"find_match_count_limit[other]": "More than {{limit}} matches",
|
||||||
find_not_found: "Phrase not found",
|
find_not_found: "Phrase not found",
|
||||||
|
|
||||||
error_version_info: "PDF.js v{{version}} (build: {{build}})",
|
|
||||||
error_message: "Message: {{message}}",
|
|
||||||
error_stack: "Stack: {{stack}}",
|
|
||||||
error_file: "File: {{file}}",
|
|
||||||
error_line: "Line: {{line}}",
|
|
||||||
rendering_error: "An error occurred while rendering the page.",
|
|
||||||
|
|
||||||
page_scale_width: "Page Width",
|
page_scale_width: "Page Width",
|
||||||
page_scale_fit: "Page Fit",
|
page_scale_fit: "Page Fit",
|
||||||
page_scale_auto: "Automatic Zoom",
|
page_scale_auto: "Automatic Zoom",
|
||||||
@ -69,6 +62,7 @@ const DEFAULT_L10N_STRINGS = {
|
|||||||
invalid_file_error: "Invalid or corrupted PDF file.",
|
invalid_file_error: "Invalid or corrupted PDF file.",
|
||||||
missing_file_error: "Missing PDF file.",
|
missing_file_error: "Missing PDF file.",
|
||||||
unexpected_response_error: "Unexpected server response.",
|
unexpected_response_error: "Unexpected server response.",
|
||||||
|
rendering_error: "An error occurred while rendering the page.",
|
||||||
|
|
||||||
printing_not_supported:
|
printing_not_supported:
|
||||||
"Warning: Printing is not fully supported by this browser.",
|
"Warning: Printing is not fully supported by this browser.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user