mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
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
3 changed files with 13 additions and 48 deletions
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.
|
||||
*/
|
||||
_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 {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.
|
||||
*/
|
||||
_otherError(message, moreInfo = null) {
|
||||
const moreInfoText = [
|
||||
this.l10n.get("error_version_info", {
|
||||
version: version || "?",
|
||||
build: build || "?",
|
||||
}),
|
||||
];
|
||||
const moreInfoText = [`PDF.js v${version || "?"} (build: ${build || "?"})`];
|
||||
if (moreInfo) {
|
||||
moreInfoText.push(
|
||||
this.l10n.get("error_message", { message: moreInfo.message })
|
||||
);
|
||||
moreInfoText.push(`Message: ${moreInfo.message}`);
|
||||
|
||||
if (moreInfo.stack) {
|
||||
moreInfoText.push(
|
||||
this.l10n.get("error_stack", { stack: moreInfo.stack })
|
||||
);
|
||||
moreInfoText.push(`Stack: ${moreInfo.stack}`);
|
||||
} else {
|
||||
if (moreInfo.filename) {
|
||||
moreInfoText.push(
|
||||
this.l10n.get("error_file", { file: moreInfo.filename })
|
||||
);
|
||||
moreInfoText.push(`File: ${moreInfo.filename}`);
|
||||
}
|
||||
if (moreInfo.lineNumber) {
|
||||
moreInfoText.push(
|
||||
this.l10n.get("error_line", { line: moreInfo.lineNumber })
|
||||
);
|
||||
moreInfoText.push(`Line: ${moreInfo.lineNumber}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Promise.all(moreInfoText).then(parts => {
|
||||
console.error(`${message}\n${parts.join("\n")}`);
|
||||
});
|
||||
console.error(`${message}\n\n${moreInfoText.join("\n")}`);
|
||||
this.fallback();
|
||||
},
|
||||
|
||||
|
@ -1481,7 +1466,7 @@ const PDFViewerApplication = {
|
|||
console.log(
|
||||
`PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +
|
||||
`${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` +
|
||||
`(PDF.js: ${version || "-"})`
|
||||
`(PDF.js: ${version || "?"} [${build || "?"}])`
|
||||
);
|
||||
let pdfTitle = info.Title;
|
||||
|
||||
|
|
|
@ -51,13 +51,6 @@ const DEFAULT_L10N_STRINGS = {
|
|||
"find_match_count_limit[other]": "More than {{limit}} matches",
|
||||
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_fit: "Page Fit",
|
||||
page_scale_auto: "Automatic Zoom",
|
||||
|
@ -69,6 +62,7 @@ const DEFAULT_L10N_STRINGS = {
|
|||
invalid_file_error: "Invalid or corrupted PDF file.",
|
||||
missing_file_error: "Missing PDF file.",
|
||||
unexpected_response_error: "Unexpected server response.",
|
||||
rendering_error: "An error occurred while rendering the page.",
|
||||
|
||||
printing_not_supported:
|
||||
"Warning: Printing is not fully supported by this browser.",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue