Skip to content

Commit

Permalink
fix(error-handler): form a correct report
Browse files Browse the repository at this point in the history
  • Loading branch information
CedrikNikita committed Sep 11, 2021
1 parent d35a603 commit 1a66e2e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"connect": "^3.7.0",
"core-js": "^3.15.1",
"date-fns": "^2.22.1",
"detect-browser": "^5.2.0",
"fontsource-ibm-plex-sans": "^3.1.5",
"i18n": "^0.13.3",
"is-fqdn": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorReportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default {
async send() {
await Backend.errorReport({
...this.report,
userComment: this.userComment,
description: this.userComment,
});
this.resolve(true);
},
Expand Down
15 changes: 9 additions & 6 deletions src/store/plugins/errorHandler.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { serializeError } from 'serialize-error';
import Vue from 'vue';
import { detect } from 'detect-browser';

export default ({ dispatch }) => {
const reportsToSend = [];
let showingErrorReportModal = false;

const handleError = async (error) => {
reportsToSend.push({
appName: 'superhero-ui',
appVersion: process.env.npm_package_version,
appRevision: process.env.COMMIT_HASH,
userAgent: window.navigator.userAgent,
location: window.location.href,
timestamp: Date.now(),
error,
browser: detect(),
platform: 'superhero-ui',
time: Date.now(),
error: {
...error,
appRevision: process.env.COMMIT_HASH,
location: window.location.href,
},
});
if (showingErrorReportModal) return;
showingErrorReportModal = true;
Expand Down

0 comments on commit 1a66e2e

Please sign in to comment.