From a4d62d127c8b3bd3c567b3457c69d446cb489345 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 6 Jun 2018 10:07:58 -0400 Subject: [PATCH 1/3] Make load errors more specific to where they are coming from (file/url) Also include the hash of the project in load errors from the server so we can debug them --- src/containers/gui.jsx | 5 ++++- src/containers/project-loader.jsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/containers/gui.jsx b/src/containers/gui.jsx index 79a85c9dc..ed2ec1785 100644 --- a/src/containers/gui.jsx +++ b/src/containers/gui.jsx @@ -65,7 +65,10 @@ class GUI extends React.Component { this.props.vm.stopAll(); } render () { - if (this.state.loadingError) throw new Error(`Failed to load project: ${this.state.errorMessage}`); + if (this.state.loadingError) { + throw new Error( + `Failed to load project from server [id=${window.location.hash}]: ${this.state.errorMessage}`); + } const { children, fetchingProject, diff --git a/src/containers/project-loader.jsx b/src/containers/project-loader.jsx index 80ef161ea..7243e5f66 100644 --- a/src/containers/project-loader.jsx +++ b/src/containers/project-loader.jsx @@ -76,7 +76,10 @@ class ProjectLoader extends React.Component { ); } render () { - if (this.state.loadingError) throw new Error(`Failed to load project: ${this.state.errorMessage}`); + if (this.state.loadingError) { + throw new Error( + `Failed to load project from file: ${this.state.errorMessage}`); + } const { /* eslint-disable no-unused-vars */ children, From cea71b90817e8c02ed49c1beec4ff7708a196991 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 6 Jun 2018 10:30:03 -0400 Subject: [PATCH 2/3] Add a new analytics event for projects loaded from file --- src/containers/project-loader.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/containers/project-loader.jsx b/src/containers/project-loader.jsx index 7243e5f66..7f178b623 100644 --- a/src/containers/project-loader.jsx +++ b/src/containers/project-loader.jsx @@ -3,6 +3,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import {connect} from 'react-redux'; +import analytics from '../lib/analytics'; + import { openLoadingProject, closeLoadingProject @@ -45,6 +47,11 @@ class ProjectLoader extends React.Component { const thisFileInput = e.target; reader.onload = () => this.props.vm.loadProject(reader.result) .then(() => { + analytics.event({ + category: 'project', + action: 'Import Project File', + nonInteraction: true + }); this.props.closeLoadingState(); // Reset the file input after project is loaded // This is necessary in case the user wants to reload a project From 79950cddd45069a1b79ed6e70a7727b06ae7b739 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 6 Jun 2018 10:30:15 -0400 Subject: [PATCH 3/3] Use the `label` field instead of `value` for analytics events --- src/lib/project-loader-hoc.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/project-loader-hoc.jsx b/src/lib/project-loader-hoc.jsx index 5735e7295..cb8501af4 100644 --- a/src/lib/project-loader-hoc.jsx +++ b/src/lib/project-loader-hoc.jsx @@ -44,7 +44,7 @@ const ProjectLoaderHOC = function (WrappedComponent) { analytics.event({ category: 'project', action: 'Load Project', - value: projectId, + label: projectId, nonInteraction: true }); }