show download errors inline
This commit is contained in:
parent
9e1e5cec46
commit
80926c8d7e
|
@ -200,15 +200,12 @@ window.addEventListener('showStyles:done', function _() {
|
||||||
* @param {string} message Message to display to user.
|
* @param {string} message Message to display to user.
|
||||||
*/
|
*/
|
||||||
function error(reason) {
|
function error(reason) {
|
||||||
dom.error.textContent =
|
dom.error.textContent = reason === 404 ? t('searchResultNoneFound') : reason;
|
||||||
reason === 404 ?
|
|
||||||
t('searchResultNoneFound') :
|
|
||||||
t('genericErrorOccurred') + '\n' + reason;
|
|
||||||
dom.error.classList.remove('hidden');
|
dom.error.classList.remove('hidden');
|
||||||
dom.container.classList.toggle('hidden', !processedResults.length);
|
dom.container.classList.toggle('hidden', !processedResults.length);
|
||||||
document.body.classList.toggle('search-results-shown', processedResults.length > 0);
|
document.body.classList.toggle('search-results-shown', processedResults.length > 0);
|
||||||
if (dom.error.getBoundingClientRect().bottom > window.innerHeight) {
|
if (dom.error.getBoundingClientRect().bottom < 0) {
|
||||||
dom.error.scrollIntoView();
|
dom.error.scrollIntoView({behavior: 'smooth', block: 'start'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +570,7 @@ window.addEventListener('showStyles:done', function _() {
|
||||||
.catch(reason => {
|
.catch(reason => {
|
||||||
const usoId = result.id;
|
const usoId = result.id;
|
||||||
console.debug('install:saveStyleSafe(usoID:', usoId, ') => [ERROR]: ', reason);
|
console.debug('install:saveStyleSafe(usoID:', usoId, ') => [ERROR]: ', reason);
|
||||||
alert('Error while downloading usoID:' + usoId + '\nReason: ' + reason);
|
error('Error while downloading usoID:' + usoId + '\nReason: ' + reason);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
$.remove('.lds-spinner', entry);
|
$.remove('.lds-spinner', entry);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user