Skip to content

Commit

Permalink
[transactions] Tx export error handling (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgptr authored Jan 5, 2021
1 parent 3b5916e commit 74e2fb0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions app/actions/StatisticsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,21 @@ export const exportStatToCSV = (opts) => (dispatch, getState) => {
// called once at the start of the stats calc function
const startFunction = (opts) => {
dispatch({ type: EXPORT_STARTED });
allSeries = opts.series.map((s) => ({
...s,
valueFormatFunc: seriesValueFormatFunc(s)
}));
seriesOpts = opts;
const seriesNames = allSeries.map((s) => s.name);
const headerLine = csvLine(["time", ...seriesNames]);

fd = fs.openSync(csvFilename, "w", 0o600);
fs.writeSync(fd, headerLine);
fs.writeSync(fd, ln);
try {
allSeries = opts.series.map((s) => ({
...s,
valueFormatFunc: seriesValueFormatFunc(s)
}));
seriesOpts = opts;
const seriesNames = allSeries.map((s) => s.name);
const headerLine = csvLine(["time", ...seriesNames]);

fd = fs.openSync(csvFilename, "w", 0o600);
fs.writeSync(fd, headerLine);
fs.writeSync(fd, ln);
} catch (err) {
errorFunction(err);
}
};

// called once for each data line
Expand Down

0 comments on commit 74e2fb0

Please sign in to comment.