From ccbefb39c7558bc296ffa3acb84a74e31a93ff28 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Tue, 29 Nov 2022 14:18:12 +0000 Subject: [PATCH] Add error reporting Former-commit-id: 204781255b87688972b6d61be9ec4a3d5a42c3ea --- www/js/lib/uiUtil.js | 2 +- www/js/lib/zimArchive.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index 4926f152..be398c74 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -848,7 +848,7 @@ define(rqDef, function(util) { if (providerAPI) { providerAPI.innerHTML = 'Search Provider: ' + (/^fulltext/.test(provider) ? 'Title + Xapian [' + provider : 'Title only [' + provider) + ']'; - providerAPI.className = /^fulltext/.test(provider) ? 'apiAvailable' : 'apiUnavailable'; + providerAPI.className = /^fulltext/.test(provider) ? 'apiAvailable' : !/ERROR/.test(provider) ? 'apiUnavailable' : 'apiBroken'; } } diff --git a/www/js/lib/zimArchive.js b/www/js/lib/zimArchive.js index 62ee1015..fb729b06 100644 --- a/www/js/lib/zimArchive.js +++ b/www/js/lib/zimArchive.js @@ -104,7 +104,7 @@ define(['zimfile', 'zimDirEntry', 'transformZimit', 'util', 'uiUtil', 'utf8'], // Update the API panel uiUtil.reportSearchProviderToAPIStatusPanel(params.searchProvider); }).catch(function (err) { - uiUtil.reportSearchProviderToAPIStatusPanel(params.searchProvider); + uiUtil.reportSearchProviderToAPIStatusPanel(params.searchProvider + ': ERROR'); console.error('The libzim worker could not be instantiated!', err); }); } else { @@ -113,7 +113,7 @@ define(['zimfile', 'zimDirEntry', 'transformZimit', 'util', 'uiUtil', 'utf8'], params.searchProvider += ': no_fulltext'; message += 'this ZIM does not have a full-text index.'; } else if (isSplitZim) { params.searchProvider += ': split_zim'; message += 'the ZIM archive is split.'; - } else { + } else if (typeof Atomics === 'undefined') { params.searchProvider += ': no_atomics'; message += 'this browser does not support Atomic operations.'; } uiUtil.reportSearchProviderToAPIStatusPanel(params.searchProvider);