Error debugging

This commit is contained in:
2026-02-17 15:50:31 -07:00
parent b94326a671
commit 4315e101bf
3 changed files with 21 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ import {
writeTextFile
} from '@tauri-apps/plugin-fs'
import './App.css'
import { message } from '@tauri-apps/plugin-dialog'
interface LauncherUpdate {
id: string
@@ -24,6 +25,7 @@ interface LauncherUpdate {
export default function App () {
const [state, setState] = useState<string>('Loading...')
const [error, setError] = useState<string>('')
useEffect(() => {
;(async () => {
@@ -40,8 +42,9 @@ export default function App () {
launcherLatestRequest = await axios.get(
'https://games.lncvrt.xyz/api/launcher/latest'
)
} catch {
} catch (e: unknown) {
setState('Failed. Check internet connection.')
setError('e0001 / ' + String(e))
return
}
@@ -50,6 +53,7 @@ export default function App () {
launcherLatestRequest.status !== 200
) {
setState('Failed. Try again later.')
setError('e0002')
return
}
@@ -76,12 +80,14 @@ export default function App () {
`https://games.lncvrt.xyz/api/launcher/loader/update-data?platform=${platform()}&arch=${arch()}`
)
launcherUpdateData = launcherUpdateRequest.data
} catch {
} catch (e: unknown) {
setState('Failed. Check internet connection.')
setError('e0003 / ' + String(e))
return
}
if (!launcherUpdateData) {
setState('Failed. Check internet connection.')
setError('e0004')
return
}
const downloadResult = await invoke('download', {
@@ -90,6 +96,7 @@ export default function App () {
})
if (downloadResult == '-1') {
setState('Failed. Check internet connection.')
setError('e0005 / ' + downloadResult)
return
} else if (downloadResult == '-2') {
setState('File integrity check failed.')
@@ -113,7 +120,7 @@ export default function App () {
<img src='/Icon.png' width={128} height={128} alt='' draggable={false} />
<div
className={`${
state !== 'Loader update required' ? 'mt-10' : 'mt-4'
state == 'Loader update required' || error != '' ? 'mt-4' : 'mt-10'
} text-center`}
>
<p className='whitespace-nowrap'>{state}</p>
@@ -126,6 +133,13 @@ export default function App () {
>
Update
</button>
<button
hidden={error == ''}
className='mt-4'
onClick={async () => await message(error, { title: 'Error', kind: 'error' })}
>
Show error
</button>
</div>
</div>
</>