This commit is contained in:
ThatOneCalculator 2022-07-05 20:19:15 -07:00
parent d9f5570b51
commit aad9579a09

View file

@ -14,10 +14,10 @@
// ブロックの中に入れないと、定義した変数がブラウザのグローバルスコープに登録されてしまい邪魔なので // ブロックの中に入れないと、定義した変数がブラウザのグローバルスコープに登録されてしまい邪魔なので
(async () => { (async () => {
window.onerror = (e) => { window.onerror = (e) => {
await renderError('SOMETHING_HAPPENED', e); renderError('SOMETHING_HAPPENED', e);
}; };
window.onunhandledrejection = (e) => { window.onunhandledrejection = (e) => {
await renderError('SOMETHING_HAPPENED_IN_PROMISE', e); renderError('SOMETHING_HAPPENED_IN_PROMISE', e);
}; };
const v = localStorage.getItem('v') || VERSION; const v = localStorage.getItem('v') || VERSION;
@ -47,7 +47,7 @@
localStorage.setItem('localeVersion', v); localStorage.setItem('localeVersion', v);
} else { } else {
await checkUpdate(); await checkUpdate();
await renderError('LOCALE_FETCH_FAILED'); renderError('LOCALE_FETCH_FAILED');
return; return;
} }
} }
@ -57,7 +57,7 @@
import(`/assets/${CLIENT_ENTRY}`) import(`/assets/${CLIENT_ENTRY}`)
.catch(async e => { .catch(async e => {
await checkUpdate(); await checkUpdate();
await renderError('APP_FETCH_FAILED', e); renderError('APP_FETCH_FAILED', e);
}) })
//#endregion //#endregion
@ -108,7 +108,7 @@
document.head.appendChild(css); document.head.appendChild(css);
} }
async function renderError(code, details) { function renderError(code, details) {
let errorsElement = document.getElementById('errors'); let errorsElement = document.getElementById('errors');
if (!errorsElement) { if (!errorsElement) {
@ -154,7 +154,7 @@
</summary> </summary>
<code>${JSON.stringify(details)}</code>`; <code>${JSON.stringify(details)}</code>`;
errorsElement.appendChild(detailsElement); errorsElement.appendChild(detailsElement);
await addStyle(` addStyle(`
* { * {
font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif; font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif;
} }