Attach handlers for process errors
Summary: ^ This is an effort to capture and log these errors as to gain visibility when failures occur. Reviewed By: passy Differential Revision: D37412861 fbshipit-source-id: 09687a31797aac4c377aa98944ab0701bdf45466
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3a8226b890
commit
ce9feae44f
@@ -111,6 +111,9 @@ async function start() {
|
|||||||
if (argv.failFast) {
|
if (argv.failFast) {
|
||||||
flipperServer.on('server-state', ({state}) => {
|
flipperServer.on('server-state', ({state}) => {
|
||||||
if (state === 'error') {
|
if (state === 'error') {
|
||||||
|
console.error(
|
||||||
|
'[flipper-server-process-exit] state changed to error, process will exit.',
|
||||||
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -123,6 +126,23 @@ async function start() {
|
|||||||
await readyForIncomingConnections(flipperServer, companionEnv);
|
await readyForIncomingConnections(flipperServer, companionEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.on('uncaughtException', (error) => {
|
||||||
|
console.error(
|
||||||
|
'[flipper-server-process-exit] uncaught exception, process will exit.',
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (reason, promise) => {
|
||||||
|
console.warn(
|
||||||
|
'[flipper-server] unhandled rejection for:',
|
||||||
|
promise,
|
||||||
|
'reason:',
|
||||||
|
reason,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
start()
|
start()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user