fix: detect BundleExtractionFailed in catch block for offline mode

runtime_bootstrap returns Err(RuntimeDegraded) when bundle extraction
fails (no network), which throws an exception in the frontend. The
catch block was formatting the raw error object as JSON instead of
showing the connection failed message with the offline button.

Now detects BundleExtractionFailed/Network error in the catch block
and shows the proper i18n connection error, making the "Start Offline"
button accessible.

cc
This commit is contained in:
vicrodh committed 2026-03-21 08:41:04 -06:00
1 parent 0416198557
commit c766357870
1 file changed
+8 -1
+8 -1
View File
@@ -150,7 +150,14 @@
} catch (err) {
console.error('Failed to initialize client:', err);
clearTimeoutTimer();
initError = formatErrorMessage(err);
// runtime_bootstrap returns Err(RuntimeDegraded) when bundle extraction
// fails (no network). Detect this and show connection error with offline button.
const errStr = typeof err === 'object' && err !== null ? JSON.stringify(err) : String(err);
if (errStr.includes('BundleExtractionFailed') || errStr.includes('Network error')) {
initError = $t('auth.connectionFailed');
} else {
initError = formatErrorMessage(err);
}
} finally {
if (!isTimedOut) {
isInitializing = false;