Error debugging
This commit is contained in:
3
bun.lock
3
bun.lock
@@ -7,6 +7,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/vite": "4.1.18",
|
"@tailwindcss/vite": "4.1.18",
|
||||||
"@tauri-apps/api": "2.10.1",
|
"@tauri-apps/api": "2.10.1",
|
||||||
|
"@tauri-apps/plugin-dialog": "2.6.0",
|
||||||
"@tauri-apps/plugin-fs": "2.4.5",
|
"@tauri-apps/plugin-fs": "2.4.5",
|
||||||
"@tauri-apps/plugin-opener": "2.5.3",
|
"@tauri-apps/plugin-opener": "2.5.3",
|
||||||
"@tauri-apps/plugin-os": "2.3.2",
|
"@tauri-apps/plugin-os": "2.3.2",
|
||||||
@@ -268,6 +269,8 @@
|
|||||||
|
|
||||||
"@tauri-apps/cli-win32-x64-msvc": ["@tauri-apps/cli-win32-x64-msvc@2.10.0", "", { "os": "win32", "cpu": "x64" }, "sha512-NTpyQxkpzGmU6ceWBTY2xRIEaS0ZLbVx1HE1zTA3TY/pV3+cPoPPOs+7YScr4IMzXMtOw7tLw5LEXo5oIG3qaQ=="],
|
"@tauri-apps/cli-win32-x64-msvc": ["@tauri-apps/cli-win32-x64-msvc@2.10.0", "", { "os": "win32", "cpu": "x64" }, "sha512-NTpyQxkpzGmU6ceWBTY2xRIEaS0ZLbVx1HE1zTA3TY/pV3+cPoPPOs+7YScr4IMzXMtOw7tLw5LEXo5oIG3qaQ=="],
|
||||||
|
|
||||||
|
"@tauri-apps/plugin-dialog": ["@tauri-apps/plugin-dialog@2.6.0", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-q4Uq3eY87TdcYzXACiYSPhmpBA76shgmQswGkSVio4C82Sz2W4iehe9TnKYwbq7weHiL88Yw19XZm7v28+Micg=="],
|
||||||
|
|
||||||
"@tauri-apps/plugin-fs": ["@tauri-apps/plugin-fs@2.4.5", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-dVxWWGE6VrOxC7/jlhyE+ON/Cc2REJlM35R3PJX3UvFw2XwYhLGQVAIyrehenDdKjotipjYEVc4YjOl3qq90fA=="],
|
"@tauri-apps/plugin-fs": ["@tauri-apps/plugin-fs@2.4.5", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-dVxWWGE6VrOxC7/jlhyE+ON/Cc2REJlM35R3PJX3UvFw2XwYhLGQVAIyrehenDdKjotipjYEVc4YjOl3qq90fA=="],
|
||||||
|
|
||||||
"@tauri-apps/plugin-opener": ["@tauri-apps/plugin-opener@2.5.3", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-CCcUltXMOfUEArbf3db3kCE7Ggy1ExBEBl51Ko2ODJ6GDYHRp1nSNlQm5uNCFY5k7/ufaK5Ib3Du/Zir19IYQQ=="],
|
"@tauri-apps/plugin-opener": ["@tauri-apps/plugin-opener@2.5.3", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-CCcUltXMOfUEArbf3db3kCE7Ggy1ExBEBl51Ko2ODJ6GDYHRp1nSNlQm5uNCFY5k7/ufaK5Ib3Du/Zir19IYQQ=="],
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/vite": "4.1.18",
|
"@tailwindcss/vite": "4.1.18",
|
||||||
"@tauri-apps/api": "2.10.1",
|
"@tauri-apps/api": "2.10.1",
|
||||||
|
"@tauri-apps/plugin-dialog": "2.6.0",
|
||||||
"@tauri-apps/plugin-fs": "2.4.5",
|
"@tauri-apps/plugin-fs": "2.4.5",
|
||||||
"@tauri-apps/plugin-opener": "2.5.3",
|
"@tauri-apps/plugin-opener": "2.5.3",
|
||||||
"@tauri-apps/plugin-os": "2.3.2",
|
"@tauri-apps/plugin-os": "2.3.2",
|
||||||
|
|||||||
20
src/App.tsx
20
src/App.tsx
@@ -14,6 +14,7 @@ import {
|
|||||||
writeTextFile
|
writeTextFile
|
||||||
} from '@tauri-apps/plugin-fs'
|
} from '@tauri-apps/plugin-fs'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
import { message } from '@tauri-apps/plugin-dialog'
|
||||||
|
|
||||||
interface LauncherUpdate {
|
interface LauncherUpdate {
|
||||||
id: string
|
id: string
|
||||||
@@ -24,6 +25,7 @@ interface LauncherUpdate {
|
|||||||
|
|
||||||
export default function App () {
|
export default function App () {
|
||||||
const [state, setState] = useState<string>('Loading...')
|
const [state, setState] = useState<string>('Loading...')
|
||||||
|
const [error, setError] = useState<string>('')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
@@ -40,8 +42,9 @@ export default function App () {
|
|||||||
launcherLatestRequest = await axios.get(
|
launcherLatestRequest = await axios.get(
|
||||||
'https://games.lncvrt.xyz/api/launcher/latest'
|
'https://games.lncvrt.xyz/api/launcher/latest'
|
||||||
)
|
)
|
||||||
} catch {
|
} catch (e: unknown) {
|
||||||
setState('Failed. Check internet connection.')
|
setState('Failed. Check internet connection.')
|
||||||
|
setError('e0001 / ' + String(e))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +53,7 @@ export default function App () {
|
|||||||
launcherLatestRequest.status !== 200
|
launcherLatestRequest.status !== 200
|
||||||
) {
|
) {
|
||||||
setState('Failed. Try again later.')
|
setState('Failed. Try again later.')
|
||||||
|
setError('e0002')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,12 +80,14 @@ export default function App () {
|
|||||||
`https://games.lncvrt.xyz/api/launcher/loader/update-data?platform=${platform()}&arch=${arch()}`
|
`https://games.lncvrt.xyz/api/launcher/loader/update-data?platform=${platform()}&arch=${arch()}`
|
||||||
)
|
)
|
||||||
launcherUpdateData = launcherUpdateRequest.data
|
launcherUpdateData = launcherUpdateRequest.data
|
||||||
} catch {
|
} catch (e: unknown) {
|
||||||
setState('Failed. Check internet connection.')
|
setState('Failed. Check internet connection.')
|
||||||
|
setError('e0003 / ' + String(e))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!launcherUpdateData) {
|
if (!launcherUpdateData) {
|
||||||
setState('Failed. Check internet connection.')
|
setState('Failed. Check internet connection.')
|
||||||
|
setError('e0004')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const downloadResult = await invoke('download', {
|
const downloadResult = await invoke('download', {
|
||||||
@@ -90,6 +96,7 @@ export default function App () {
|
|||||||
})
|
})
|
||||||
if (downloadResult == '-1') {
|
if (downloadResult == '-1') {
|
||||||
setState('Failed. Check internet connection.')
|
setState('Failed. Check internet connection.')
|
||||||
|
setError('e0005 / ' + downloadResult)
|
||||||
return
|
return
|
||||||
} else if (downloadResult == '-2') {
|
} else if (downloadResult == '-2') {
|
||||||
setState('File integrity check failed.')
|
setState('File integrity check failed.')
|
||||||
@@ -113,7 +120,7 @@ export default function App () {
|
|||||||
<img src='/Icon.png' width={128} height={128} alt='' draggable={false} />
|
<img src='/Icon.png' width={128} height={128} alt='' draggable={false} />
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
state !== 'Loader update required' ? 'mt-10' : 'mt-4'
|
state == 'Loader update required' || error != '' ? 'mt-4' : 'mt-10'
|
||||||
} text-center`}
|
} text-center`}
|
||||||
>
|
>
|
||||||
<p className='whitespace-nowrap'>{state}</p>
|
<p className='whitespace-nowrap'>{state}</p>
|
||||||
@@ -126,6 +133,13 @@ export default function App () {
|
|||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
hidden={error == ''}
|
||||||
|
className='mt-4'
|
||||||
|
onClick={async () => await message(error, { title: 'Error', kind: 'error' })}
|
||||||
|
>
|
||||||
|
Show error
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user