Exporting a Flipper trace should not swallow errors

Summary: Noticed that when creating a flipper trace file, the errors were only shown in the console, but the dialog would hide.

Reviewed By: jknoxville, passy

Differential Revision: D29327500

fbshipit-source-id: 0ec60be28b5e3041f7cacd48ac4bcf13753f7219
This commit is contained in:
Michel Weststrate
2021-06-29 08:02:53 -07:00
committed by Facebook GitHub Bot
parent 8359f74a21
commit d02c560150

View File

@@ -131,7 +131,12 @@ export default class ShareSheetExportFile extends Component<Props, State> {
requireInteraction: true, requireInteraction: true,
}); });
} }
this.setState({fetchMetaDataErrors, result: {kind: 'success'}}); this.setState({
fetchMetaDataErrors,
result: fetchMetaDataErrors
? {error: JSON.stringify(fetchMetaDataErrors) as any, kind: 'error'}
: {kind: 'success'},
});
this.store.dispatch(unsetShare()); this.store.dispatch(unsetShare());
this.props.logger.trackTimeSince(mark, 'export:file-success'); this.props.logger.trackTimeSince(mark, 'export:file-success');
} catch (err) { } catch (err) {
@@ -145,8 +150,9 @@ export default class ShareSheetExportFile extends Component<Props, State> {
if (!this.state.runInBackground) { if (!this.state.runInBackground) {
// Show the error in UI. // Show the error in UI.
this.setState({result}); this.setState({result});
} } else {
this.store.dispatch(unsetShare()); this.store.dispatch(unsetShare());
}
this.props.logger.trackTimeSince(mark, 'export:file-error', result); this.props.logger.trackTimeSince(mark, 'export:file-error', result);
throw err; throw err;
} }