improve error handling of client boot
This commit is contained in:
		
							parent
							
								
									61e26696aa
								
							
						
					
					
						commit
						cb00786f1e
					
				
					 1 changed files with 15 additions and 9 deletions
				
			
		|  | @ -59,6 +59,7 @@ | ||||||
| 	import(`/assets/${CLIENT_ENTRY}`) | 	import(`/assets/${CLIENT_ENTRY}`) | ||||||
| 		.catch(async e => { | 		.catch(async e => { | ||||||
| 			await checkUpdate(); | 			await checkUpdate(); | ||||||
|  | 			console.error(e); | ||||||
| 			renderError('APP_FETCH_FAILED', e); | 			renderError('APP_FETCH_FAILED', e); | ||||||
| 		}) | 		}) | ||||||
| 	//#endregion
 | 	//#endregion
 | ||||||
|  | @ -271,7 +272,7 @@ | ||||||
| 
 | 
 | ||||||
| 	// eslint-disable-next-line no-inner-declarations
 | 	// eslint-disable-next-line no-inner-declarations
 | ||||||
| 	async function checkUpdate() { | 	async function checkUpdate() { | ||||||
| 		// TODO: サーバーが落ちている場合などのエラーハンドリング
 | 		try { | ||||||
| 			const res = await fetch('/api/meta', { | 			const res = await fetch('/api/meta', { | ||||||
| 				method: 'POST', | 				method: 'POST', | ||||||
| 				cache: 'no-cache' | 				cache: 'no-cache' | ||||||
|  | @ -283,6 +284,11 @@ | ||||||
| 				localStorage.setItem('v', meta.version); | 				localStorage.setItem('v', meta.version); | ||||||
| 				refresh(); | 				refresh(); | ||||||
| 			} | 			} | ||||||
|  | 		} catch (e) { | ||||||
|  | 			console.error(e); | ||||||
|  | 			renderError('UPDATE_CHECK_FAILED', e); | ||||||
|  | 			throw e; | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// eslint-disable-next-line no-inner-declarations
 | 	// eslint-disable-next-line no-inner-declarations
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue