Skip to content

Commit dd43c53

Browse files
authored
Merge pull request scratchfoundation#5164 from paulkaplan/moar-saving-telemetry
Emit projectDidSave for all types of saves, not just file exports
2 parents 065e5b6 + 2429f63 commit dd43c53

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/lib/project-saver-hoc.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ const ProjectSaverHOC = function (WrappedComponent) {
251251
if (id && this.props.onUpdateProjectThumbnail) {
252252
this.storeProjectThumbnail(id);
253253
}
254+
this.reportTelemetryEvent('projectDidSave');
254255
return response;
255256
})
256257
.catch(err => {
@@ -291,9 +292,15 @@ const ProjectSaverHOC = function (WrappedComponent) {
291292
*/
292293
// TODO make a telemetry HOC and move this stuff there
293294
reportTelemetryEvent (event) {
294-
if (this.props.onProjectTelemetryEvent) {
295-
const metadata = collectMetadata(this.props.vm, this.props.reduxProjectTitle, this.props.locale);
296-
this.props.onProjectTelemetryEvent(event, metadata);
295+
try {
296+
if (this.props.onProjectTelemetryEvent) {
297+
const metadata = collectMetadata(this.props.vm, this.props.reduxProjectTitle, this.props.locale);
298+
this.props.onProjectTelemetryEvent(event, metadata);
299+
}
300+
} catch (e) {
301+
log.error('Telemetry error', event, e);
302+
// This is intentionally fire/forget because a failure
303+
// to report telemetry should not block saving
297304
}
298305
}
299306

0 commit comments

Comments
 (0)