Do not fail if there are entries in errorArray from exportStore

Summary:
Currently `exportStore` function returns the serialized string along with errorArray. errorArray contains an error when there is some issue with fetching metadata. Essentially, it keeps the error in the errorArray and continues with fetching the data for the next plugin. Previously we used to exit our submit form execution when the errorArray had any value. So this diff removes that check and instead logs it on the console and in our logging system.
It will handle the case mentioned [here](https://fb.workplace.com/groups/1430200360634661/permalink/2566831316971554/)

This diff also adds a log when there is failure to upload flipper data.

Reviewed By: mweststrate

Differential Revision: D19723674

fbshipit-source-id: 18bf90461156f67ecc2b4ce4b1eac4aa3485188d
This commit is contained in:
Pritesh Nandgaonkar
2020-02-05 04:23:09 -08:00
committed by Facebook Github Bot
parent 8b7b911637
commit d9c8b5dd64

View File

@@ -43,6 +43,7 @@ import {deconstructClientId, deconstructPluginKey} from '../utils/clientUtils';
import {performance} from 'perf_hooks';
import {processMessageQueue} from './messageQueue';
import {getPluginTitle} from './pluginUtils';
import {logPlatformSuccessRate} from './metrics';
export const IMPORT_FLIPPER_TRACE_EVENT = 'import-flipper-trace';
export const EXPORT_FLIPPER_TRACE_EVENT = 'export-flipper-trace';
@@ -616,6 +617,15 @@ export async function exportStore(
plugins: state.plugins.selectedPlugins,
},
);
if (errorArray.length > 0) {
const errorStr = errorArray.join(', ');
logPlatformSuccessRate('export-store-task', {
kind: 'failure',
supportedOperation: true,
error: errorStr,
});
console.error('Export Store Task Failures: ', errorStr);
}
return {serializedString, errorArray};
} else {
return {serializedString: '{}', errorArray: []};