ブラウザ版でhead.txt、kanri.txtの取得を失敗した際に該当箇所にエラー文章を表示
This commit is contained in:
parent
c29b659853
commit
c88fbba6d5
|
@ -35,7 +35,7 @@ if (document.getElementById('kokuti')) {
|
|||
async function getLocalHtml (targetId, targetFile, isShiftJIS) {
|
||||
try{
|
||||
const response = await fetch(targetFile, {cache: 'no-store'});
|
||||
if(!response.ok) throw new Error();
|
||||
if(!response.ok) throw new Error('response error');
|
||||
if(isShiftJIS){
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
const utf8Text = arrayBufferToUtf8(arrayBuffer);
|
||||
|
@ -46,6 +46,7 @@ async function getLocalHtml (targetId, targetFile, isShiftJIS) {
|
|||
}
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
document.getElementById(targetId).innerHTML += 'ファイルの取得に失敗しました。';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ if (document.getElementById('kokuti')) {
|
|||
async function getLocalHtml (targetId, targetFile, isShiftJIS) {
|
||||
try{
|
||||
const response = await fetch(targetFile, {cache: 'no-store'});
|
||||
if(!response.ok) throw new Error();
|
||||
if(!response.ok) throw new Error('response error');
|
||||
if(isShiftJIS){
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
const utf8Text = arrayBufferToUtf8(arrayBuffer);
|
||||
|
@ -97,6 +97,7 @@ async function getLocalHtml (targetId, targetFile, isShiftJIS) {
|
|||
}
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
document.getElementById(targetId).innerHTML += 'ファイルの取得に失敗しました。';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue