Merge pull request #2261 from paulkaplan/better-loader-errors
Better project loading analytics and errors
This commit is contained in:
3 files changed
+16
-3
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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
|
||||
@@ -76,7 +83,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,
|
||||
|
||||
@@ -44,7 +44,7 @@ const ProjectLoaderHOC = function (WrappedComponent) {
|
||||
analytics.event({
|
||||
category: 'project',
|
||||
action: 'Load Project',
|
||||
value: projectId,
|
||||
label: projectId,
|
||||
nonInteraction: true
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user