mirror of
https://github.com/marcrobledo/RomPatcher.js.git
synced 2025-06-27 16:25:54 +00:00
feat (web): show initialization errors on browser console before throwing exceptions
This commit is contained in:
parent
c5c39a7703
commit
a5f57f73ba
2 changed files with 22 additions and 17 deletions
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var PRECACHE_ID = 'rom-patcher-js';
|
var PRECACHE_ID = 'rom-patcher-js';
|
||||||
var PRECACHE_VERSION = 'v30rc2';
|
var PRECACHE_VERSION = 'v30rc2b';
|
||||||
var PRECACHE_URLS = [
|
var PRECACHE_URLS = [
|
||||||
'/RomPatcher.js/', '/RomPatcher.js/index.html',
|
'/RomPatcher.js/', '/RomPatcher.js/index.html',
|
||||||
'/RomPatcher.js/manifest.json',
|
'/RomPatcher.js/manifest.json',
|
||||||
|
|
|
@ -523,6 +523,7 @@ var RomPatcherWeb = (function () {
|
||||||
|
|
||||||
/* check if zip-js web worker is available */
|
/* check if zip-js web worker is available */
|
||||||
if (typeof zip !== 'object' || typeof zip.useWebWorkers !== 'boolean') {
|
if (typeof zip !== 'object' || typeof zip.useWebWorkers !== 'boolean') {
|
||||||
|
console.error('Rom Patcher JS: zip.js web worker not found');
|
||||||
throw new Error('Rom Patcher JS: zip.js web worker not found');
|
throw new Error('Rom Patcher JS: zip.js web worker not found');
|
||||||
}
|
}
|
||||||
zip.useWebWorkers = true;
|
zip.useWebWorkers = true;
|
||||||
|
@ -536,6 +537,7 @@ var RomPatcherWeb = (function () {
|
||||||
new BinFile(this, RomPatcherWeb.provideRomFile);
|
new BinFile(this, RomPatcherWeb.provideRomFile);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
console.error('Rom Patcher JS: input#rom-patcher-input-file-rom[type=file] not found');
|
||||||
throw new Error('Rom Patcher JS: input#rom-patcher-input-file-rom[type=file] not found');
|
throw new Error('Rom Patcher JS: input#rom-patcher-input-file-rom[type=file] not found');
|
||||||
}
|
}
|
||||||
if (validEmbededPatch) {
|
if (validEmbededPatch) {
|
||||||
|
@ -546,6 +548,7 @@ var RomPatcherWeb = (function () {
|
||||||
this._unzipSelectedPatch(zippedEntryIndex);
|
this._unzipSelectedPatch(zippedEntryIndex);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
console.error('Rom Patcher JS: select#rom-patcher-select-patch not found');
|
||||||
throw new Error('Rom Patcher JS: select#rom-patcher-select-patch not found');
|
throw new Error('Rom Patcher JS: select#rom-patcher-select-patch not found');
|
||||||
}
|
}
|
||||||
const loadingSpan = document.createElement('span');
|
const loadingSpan = document.createElement('span');
|
||||||
|
@ -564,6 +567,7 @@ var RomPatcherWeb = (function () {
|
||||||
new BinFile(this, RomPatcherWeb.providePatchFile);
|
new BinFile(this, RomPatcherWeb.providePatchFile);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
console.error('Rom Patcher JS: input#rom-patcher-input-file-patch[type=file] not found');
|
||||||
throw new Error('Rom Patcher JS: input#rom-patcher-input-file-patch[type=file] not found');
|
throw new Error('Rom Patcher JS: input#rom-patcher-input-file-patch[type=file] not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,6 +575,7 @@ var RomPatcherWeb = (function () {
|
||||||
if (htmlButtonApply && htmlButtonApply.tagName === 'BUTTON') {
|
if (htmlButtonApply && htmlButtonApply.tagName === 'BUTTON') {
|
||||||
htmlButtonApply.addEventListener('click', RomPatcherWeb.applyPatch);
|
htmlButtonApply.addEventListener('click', RomPatcherWeb.applyPatch);
|
||||||
} else {
|
} else {
|
||||||
|
console.error('Rom Patcher JS: button#rom-patcher-button-apply not found');
|
||||||
throw new Error('Rom Patcher JS: button#rom-patcher-button-apply not found');
|
throw new Error('Rom Patcher JS: button#rom-patcher-button-apply not found');
|
||||||
}
|
}
|
||||||
const htmlCheckboxAlterHeader = htmlElements.get('checkbox-alter-header');
|
const htmlCheckboxAlterHeader = htmlElements.get('checkbox-alter-header');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue