Better error message format

Summary:
The existing error message was not in the centre and didn't give any possible remediation steps.

{F1015240268}

Reviewed By: passy

Differential Revision: D46394149

fbshipit-source-id: 09d450bef9df83c5b3af3ba49c7e0fafb81bfdce
This commit is contained in:
Lorenzo Blasa
2023-06-02 09:35:32 -07:00
committed by Facebook GitHub Bot
parent 80c201b10f
commit 353e51e2ea
3 changed files with 62 additions and 31 deletions

View File

@@ -231,8 +231,8 @@ async function start() {
start().catch((e) => { start().catch((e) => {
console.error('Failed to start Flipper desktop', e); console.error('Failed to start Flipper desktop', e);
document.getElementById('root')!.textContent = document.getElementById('loading')!.textContent =
'Failed to start Flipper desktop: ' + e; 'Failed to start Flipper. ' + e;
}); });
function getStaticPath(appPath: string) { function getStaticPath(appPath: string) {

View File

@@ -47,7 +47,11 @@ export function createFlipperServerWithSocket(
let initialConnectionTimeout: ReturnType<typeof setTimeout> | undefined = let initialConnectionTimeout: ReturnType<typeof setTimeout> | undefined =
setTimeout(() => { setTimeout(() => {
reject( reject(
new Error('Failed to connect to flipper-server in a timely manner'), new Error(
`Failed to connect to the server in a timely manner.
It may be unresponsive. Run the following from the terminal
'lsof -nP -iTCP -sTCP:LISTEN | grep 52342' and kill the listed process, if any.`,
),
); );
}, CONNECTION_TIMEOUT); }, CONNECTION_TIMEOUT);

View File

@@ -1,32 +1,59 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8"> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta charset="utf-8">
<link rel="stylesheet" href="style.css"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link id="flipper-theme-import" rel="stylesheet"> <link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="graphiql/graphiql.css"> <link id="flipper-theme-import" rel="stylesheet">
<link rel="stylesheet" href="vis/vis.min.css"> <link rel="stylesheet" href="graphiql/graphiql.css">
<title>Flipper</title> <link rel="stylesheet" href="vis/vis.min.css">
</head> <title>Flipper</title>
<body> <style>
<div id="root"></div> #loading {
<script> -webkit-app-region: drag;
global.electronRequire = window.require; z-index: 999999;
</script> position: absolute;
<script> top: 0;
// load correct theme (n.b. this doesn't handle system value specifically, will assume light in such cases) left: 0;
try { bottom: 0;
if (JSON.parse(window.process.env.CONFIG).darkMode === 'dark') { right: 0;
document.getElementById('flipper-theme-import').href="themes/dark.css"; padding: 50px;
} else { overflow: auto;
document.getElementById('flipper-theme-import').href="themes/light.css"; display: flex;
} align-items: center;
} catch(e) { justify-content: center;
console.error("Failed to initialize theme", e); font-size: 20px;
document.getElementById('flipper-theme-import').href="themes/light.css"; color: #525252;
text-align: center;
}
</style>
</head>
<body>
<div id="root">
<div id="loading">
Loading...
</div>
</div>
<script>
global.electronRequire = window.require;
</script>
<script>
// load correct theme (n.b. this doesn't handle system value specifically, will assume light in such cases)
try {
if (JSON.parse(window.process.env.CONFIG).darkMode === 'dark') {
document.getElementById('flipper-theme-import').href = "themes/dark.css";
} else {
document.getElementById('flipper-theme-import').href = "themes/light.css";
} }
</script> } catch (e) {
<script src="bundle.js"></script> console.error("Failed to initialize theme", e);
</body> document.getElementById('flipper-theme-import').href = "themes/light.css";
}
</script>
<script src="bundle.js"></script>
</body>
</html> </html>