Make sure flipper server initialization errors are propagated properly

Summary:
This diff makes sure that errors are propagated similarly in flipper desktop and browser version, and that they are shown in either case.

Since in the browser version, the UI loads after the error happened, we'll store the error so that any client connecting in the future will read and report it.

Also added a `--failFast` flag to flipper-server, so that the process exits immediately if misconfigured, which is convenient in CI use cases and such

Reviewed By: nikoant

Differential Revision: D33348922

fbshipit-source-id: 0f584104f881141fde38da3f0031748415343ea2
This commit is contained in:
Michel Weststrate
2022-01-04 02:56:33 -08:00
committed by Facebook GitHub Bot
parent 8259f92983
commit b6c884f011
13 changed files with 96 additions and 46 deletions

View File

@@ -115,13 +115,10 @@ export default class CertificateProvider {
this._adb = await getAdbClient(this.config);
} catch (_e) {
// make sure initialization failure is already logged
const msg =
'Failed to initialize ADB. Please disable Android support in settings, or configure a correct path';
this.server.flipperServer.emit('notification', {
type: 'error',
title: 'Failed to initialise ADB',
description: msg,
});
throw new Error(
'Failed to initialize ADB. Please disable Android support in settings, or configure a correct path. ' +
_e,
);
}
}
}