From bf8a58e5e3504b6a129d4fb41ced87601191ae4d Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Jan 2022 11:14:29 +0100 Subject: [PATCH] Dispatch a "documenterror" event in `PDFViewerApplication._documentError` (issue 14451) *Please note:* This is a tentative patch, since I don't know if this is deemed important enough to fix. The new event could be seen as a *supplement* to the existing "documentinit" and "documentloaded" events, but for the case when a PDF document fails to load. To make the "documenterror" event generally useful, it'll include both the localized error message as well as the original reason for the error (when that exists). --- web/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/app.js b/web/app.js index 2824358d1..347ab5261 100644 --- a/web/app.js +++ b/web/app.js @@ -1057,6 +1057,12 @@ const PDFViewerApplication = { this._unblockDocumentLoadEvent(); this._otherError(message, moreInfo); + + this.eventBus.dispatch("documenterror", { + source: this, + message, + reason: moreInfo?.message ?? null, + }); }, /**