Don't raise EADDRINUSE as error on startup
Summary: There will likely be more so I added a place for inspecting these messages to the top. Reviewed By: antonk52 Differential Revision: D34681084 fbshipit-source-id: ad32145d44dba08b813d8a2ddc63d500a0c360d8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
44f57b1601
commit
a5529d789d
@@ -53,6 +53,14 @@ import {assertNotNull} from './comms/Utilities';
|
|||||||
const {access, copyFile, mkdir, unlink, stat, readlink, readFile, writeFile} =
|
const {access, copyFile, mkdir, unlink, stat, readlink, readFile, writeFile} =
|
||||||
promises;
|
promises;
|
||||||
|
|
||||||
|
function isHandledStartupError(e: Error) {
|
||||||
|
if (e.message.includes('EADDRINUSE')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FlipperServer takes care of all incoming device & client connections.
|
* FlipperServer takes care of all incoming device & client connections.
|
||||||
* It will set up managers per device type, and create the incoming
|
* It will set up managers per device type, and create the incoming
|
||||||
@@ -163,7 +171,9 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
await this.startDeviceListeners();
|
await this.startDeviceListeners();
|
||||||
this.setServerState('started');
|
this.setServerState('started');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to start FlipperServer', e);
|
if (!isHandledStartupError(e)) {
|
||||||
|
console.error('Failed to start FlipperServer', e);
|
||||||
|
}
|
||||||
this.setServerState('error', e);
|
this.setServerState('error', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user