1616
1717 export let client;
1818 export let options;
19+ export let error;
1920
2021 let running = false ;
2122
6869 }
6970
7071 async function updateData () {
71- const newBuilds = await invoke (" request_builds" , {
72- client,
73- branch: options .version .branchName ,
74- release: ! options .launcher .showNightlyBuilds
75- });
72+ let newBuilds;
73+ try {
74+ newBuilds = await invoke (" request_builds" , {
75+ client,
76+ branch: options .version .branchName ,
77+ release: ! options .launcher .showNightlyBuilds
78+ });
79+ } catch (e) {
80+ console .error (" Failed to request builds:" , e);
81+ error = {
82+ message: " Failed to establish connection with LiquidBounce API" ,
83+ error: e
84+ };
85+ return ;
86+ }
7687
7788 newBuilds .forEach (build => {
7889 const date = new Date (build .date );
131142 }
132143
133144 async function runClientWithWarning () {
145+ if (! versionState .currentBuild ) return ;
134146 const isWarning = options .version .branchName === " legacy" ||
135147 (options .version .branchName === " nextgen" && options .version .buildId !== - 1 );
136148
273285 });
274286
275287 onMount (async () => {
276- let branchesData = await invoke (" request_branches" , {
277- client
278- });
288+ let branchesData;
289+ try {
290+ branchesData = await invoke (" request_branches" , {
291+ client
292+ });
293+ } catch (e) {
294+ console .error (" Failed to request branches:" , e);
295+ error = {
296+ message: " Failed to establish connection with LiquidBounce API" ,
297+ error: e
298+ };
299+ return ;
300+ }
279301 versionState .branches = branchesData .branches .sort ((a , b ) =>
280302 (a === branchesData .defaultBranch ? - 1 : b === branchesData .defaultBranch ? 1 : 0 ));
281303
358380 }}
359381 mcVersion= {versionState .currentBuild ? .mcVersion || " Loading..." }
360382 lbVersion= {versionState .currentBuild ? .lbVersion || " Loading..." }
383+ canLaunch= {!! versionState .currentBuild }
361384 {running}
362385 on: showVersionSelect= {() => versionSelectShown = true }
363386 on: showClientLog= {() => logShown = true }
366389 / >
367390 < NewsArea {client} / >
368391 < / ContentWrapper>
369- < / VerticalFlexWrapper>
392+ < / VerticalFlexWrapper>
0 commit comments