Preserve previous error messages

Reviewed By: passy

Differential Revision: D51197113

fbshipit-source-id: 237c6f1f894cb4d758150ff2bddf14c104d3b381
This commit is contained in:
Andrey Goncharov
2023-11-10 03:39:32 -08:00
committed by Facebook GitHub Bot
parent 8348d617d0
commit 4b3f572205
6 changed files with 53 additions and 13 deletions

View File

@@ -270,7 +270,7 @@ function showCompileError() {
// Symbolicating compile errors is wasted effort
// because the stack trace is meaningless:
(error as any).preventSymbolication = true;
window.flipperShowMessage?.(message);
window.flipperShowMessage?.({detail: message});
throw error;
}

View File

@@ -24,7 +24,7 @@ declare global {
FLIPPER_UNIXNAME: string;
FLIPPER_AUTH_TOKEN: string;
flipperShowMessage?(message: string): void;
flipperShowMessage?(message: {title?: string; detail?: string}): void;
flipperHideMessage?(): void;
}
}

View File

@@ -51,7 +51,7 @@ async function start() {
const params = new URL(location.href).searchParams;
const tokenProvider = async () => {
const tokenProvider = () => {
const providerParams = new URL(location.href).searchParams;
let token = providerParams.get('token');
if (!token) {
@@ -62,6 +62,11 @@ async function start() {
'[flipper-client][ui-browser] Failed to get token from HTML',
token,
);
window.flipperShowMessage?.({
detail:
'[flipper-client][ui-browser] Failed to get token from HTML: ' +
token,
});
}
}
@@ -108,7 +113,7 @@ async function start() {
switch (state) {
case FlipperServerState.CONNECTING:
getLogger().info('[flipper-client] Connecting to server');
window.flipperShowMessage?.('Connecting to server...');
window.flipperShowMessage?.({title: 'Connecting to server...'});
break;
case FlipperServerState.CONNECTED:
getLogger().info(
@@ -118,7 +123,7 @@ async function start() {
break;
case FlipperServerState.DISCONNECTED:
getLogger().info('[flipper-client] Disconnected from server');
window.flipperShowMessage?.('Waiting for server...');
window.flipperShowMessage?.({title: 'Waiting for server...'});
break;
}
},
@@ -172,7 +177,7 @@ start().catch((e) => {
error: getStringFromErrorLike(e),
pwa: window.matchMedia('(display-mode: standalone)').matches,
});
window.flipperShowMessage?.('Failed to start UI with error: ' + e);
window.flipperShowMessage?.({detail: 'Failed to start UI with error: ' + e});
});
async function initializePWA() {