From 1101306249da8efe6253ac05ec96264cc344d4ef Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 31 Jan 2019 03:14:05 -0800 Subject: [PATCH] Move FLIPPER_PORTS error handling out of function Summary: The function itself can easily be pure. Let's have the side-effects (lookup of env variable and error handling) outside of it. Also prevents spam in the test log (which I intend to make a test failure going forwards). Current output: {F149794656} Reviewed By: jknoxville Differential Revision: D13894995 fbshipit-source-id: dacf51f8b35cb427740f9566ef993ffc6b2c3906 --- src/dispatcher/application.js | 6 ++++++ src/utils/environmentVariables.js | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dispatcher/application.js b/src/dispatcher/application.js index a506c0014..98d4e9055 100644 --- a/src/dispatcher/application.js +++ b/src/dispatcher/application.js @@ -70,6 +70,12 @@ export default (store: Store, logger: Logger) => { type: 'SET_SERVER_PORTS', payload: portOverrides, }); + } else { + console.error( + `Ignoring malformed FLIPPER_PORTS env variable: + "${process.env.FLIPPER_PORTS || ''}". + Example expected format: "1111,2222".`, + ); } } }; diff --git a/src/utils/environmentVariables.js b/src/utils/environmentVariables.js index cd16c7be6..1a7267b78 100644 --- a/src/utils/environmentVariables.js +++ b/src/utils/environmentVariables.js @@ -21,9 +21,5 @@ export function parseFlipperPorts( insecure: ports[0], secure: ports[1], }; - } else { - console.error( - `Ignoring malformed FLIPPER_PORTS env variable: "${envVar}". Example expected format: "1111,2222".`, - ); } }