More exit handling fixes

Summary:
Line 166 is missing a process.exit() causing the process to stay open forever if anything goes wrong.

Making everything use errorAndExit, and making use of the utility function so we don't need to remember when to print e, and when to print e.message.

Reviewed By: passy

Differential Revision: D15989164

fbshipit-source-id: c683fa07d98fe49283a59b5f8108ef54babc97a3
This commit is contained in:
John Knox
2019-06-26 09:14:33 -07:00
committed by Facebook Github Bot
parent 1fd5fa23a1
commit 34f835ace8
2 changed files with 38 additions and 27 deletions

View File

@@ -290,11 +290,11 @@ export function exportStore(
const {exportData, errorArray} = await getStoreExport(store);
if (!exportData) {
console.error('Make sure a device is connected');
reject('No device is selected');
reject(new Error('No device is selected'));
}
const serializedString = serialize(exportData);
if (serializedString.length <= 0) {
reject('Serialize function returned empty string');
reject(new Error('Serialize function returned empty string'));
}
resolve({serializedString, errorArray});
} catch (e) {