From 32351b07b7e7fa15c55f7a89d8dbca30723d25e8 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 28 May 2023 07:10:00 -0600 Subject: [PATCH] prefer console.error messages for errors --- project.task.yaml | 1 - .../World/components/objects/landmarks.js | 5 ++--- src/views/AccountViewView.vue | 6 +++--- src/views/ContactAmountsView.vue | 4 ++-- src/views/ContactsView.vue | 6 +++--- src/views/ImportAccountView.vue | 3 +-- src/views/NewEditProjectView.vue | 14 +++++++------- src/views/ProjectViewView.vue | 6 ++---- src/views/ProjectsView.vue | 7 ++----- src/views/SeedBackupView.vue | 2 +- 10 files changed, 23 insertions(+), 31 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index 89b8974f..897517c5 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -7,7 +7,6 @@ - replace user-affecting console.log & console.error with error messages (eg. catches) - stats v1 : - - use all bits of randomness for location - 01 show numeric stats - 01 link to world for specific stats diff --git a/src/components/World/components/objects/landmarks.js b/src/components/World/components/objects/landmarks.js index 0d0ff62a..9937d9cf 100644 --- a/src/components/World/components/objects/landmarks.js +++ b/src/components/World/components/objects/landmarks.js @@ -4,7 +4,6 @@ import * as THREE from "three"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader"; import * as SkeletonUtils from "three/addons/utils/SkeletonUtils"; import * as TWEEN from "@tweenjs/tween.js"; -import { AppString } from "@/constants/app"; import { accountsDB, db } from "@/db"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { accessToken } from "@/libs/crypto"; @@ -118,7 +117,7 @@ export async function loadLandmarks(vue, world, scene, loop) { world.lights = [...world.lights, light]; } } else { - console.log( + console.error( "Got bad server response status & data of", resp.status, resp.data @@ -129,7 +128,7 @@ export async function loadLandmarks(vue, world, scene, loop) { ); } } catch (error) { - console.log("Got exception contacting server:", error); + console.error("Got exception contacting server:", error); vue.setAlert( "Error With Server", "There was a problem retrieving your claims from the server." diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index f391d869..fe5e4f2c 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -437,7 +437,7 @@ export default class AccountViewView extends Vue { } catch (err) { this.alertMessage = "Clear your cache and start over (after data backup). See console log for more info."; - console.log("Telling user to clear cache because:", err); + console.error("Telling user to clear cache because:", err); this.alertTitle = "Error Creating Account"; this.isAlertVisible = true; } @@ -452,7 +452,7 @@ export default class AccountViewView extends Vue { } catch (err) { this.alertMessage = "Clear your cache and start over (after data backup). See console log for more info."; - console.log("Telling user to clear cache because:", err); + console.error("Telling user to clear cache because:", err); this.alertTitle = "Error Creating Account"; this.isAlertVisible = true; } @@ -503,7 +503,7 @@ export default class AccountViewView extends Vue { const serverError = error as AxiosError; this.alertTitle = "Error from Server"; - console.log("Bad response retrieving limits: ", serverError); + console.error("Bad response retrieving limits: ", serverError); // Anybody know how to access items inside "response.data" without this? // eslint-disable-next-line @typescript-eslint/no-explicit-any const data: any = serverError.response?.data; diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 5bc7fd71..cd760eee 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -189,7 +189,7 @@ export default class ContactsView extends Vue { if (resp.status === 200) { result = resp.data.data; } else { - console.log( + console.error( "Got bad response status & data of", resp.status, resp.data @@ -215,7 +215,7 @@ export default class ContactsView extends Vue { if (resp2.status === 200) { result = R.concat(result, resp2.data.data); } else { - console.log( + console.error( "Got bad response status & data of", resp2.status, resp2.data diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index ddddb12a..106bbc4e 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -362,7 +362,7 @@ export default class ContactsView extends Vue { this.givenByMeConfirmed = contactConfirmed; this.givenByMeUnconfirmed = contactUnconfirmed; } else { - console.log( + console.error( "Got bad response status & data of", resp.status, resp.data @@ -416,7 +416,7 @@ export default class ContactsView extends Vue { this.givenToMeConfirmed = contactConfirmed; this.givenToMeUnconfirmed = contactUnconfirmed; } else { - console.log( + console.error( "Got bad response status & data of", resp.status, resp.data @@ -583,7 +583,7 @@ export default class ContactsView extends Vue { db.contacts.update(contact.did, { seesMe: visibility }); } else { this.alertTitle = "Error With Server"; - console.log("Bad response setting visibility: ", resp.data); + console.error("Bad response setting visibility: ", resp.data); if (resp.data.error?.message) { this.alertMessage = resp.data.error?.message; } else { diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index 85cf7add..8c34383d 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -93,8 +93,7 @@ export default class ImportAccountView extends Vue { }); this.$router.push({ name: "account" }); } catch (err) { - console.log("Error!"); - console.log(err); + console.error("Error saving mnemonic & updating settings:", err); } } } diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index d7beedef..0644c9a9 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -122,7 +122,7 @@ export default class NewEditProjectView extends Vue { await accountsDB.open(); const num_accounts = await accountsDB.accounts.count(); if (num_accounts === 0) { - console.log("Problem! Should have a profile!"); + console.error("Problem! Should have a profile!"); } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === this.activeDid, accounts); @@ -145,14 +145,13 @@ export default class NewEditProjectView extends Vue { try { const resp = await this.axios.get(url, { headers }); - console.log(resp.status, resp.data); if (resp.status === 200) { const claim = resp.data.claim; this.projectName = claim.name; this.description = claim.description; } } catch (error) { - console.log(error); + console.error("Got error retrieving that project", error); } } @@ -200,7 +199,6 @@ export default class NewEditProjectView extends Vue { try { const resp = await this.axios.post(url, payload, { headers }); - console.log("Got resp data:", resp.data); // handleId is new in server v release-1.6.0; remove fullIri when that // version shows up here: https://endorser.ch:3000/api-docs/ if (resp.data?.success?.handleId || resp.data?.success?.fullIri) { @@ -217,7 +215,6 @@ export default class NewEditProjectView extends Vue { const route = { name: "project", }; - console.log(route); that.$router.push(route); }, 2000, @@ -238,7 +235,10 @@ export default class NewEditProjectView extends Vue { this.alertMessage = JSON.stringify(serverError.toJSON()); } } else { - console.log("Here's the full error trying to save the claim:", error); + console.error( + "Here's the full error trying to save the claim:", + error + ); this.alertTitle = "Claim Error"; this.alertMessage = error as string; } @@ -254,7 +254,7 @@ export default class NewEditProjectView extends Vue { await accountsDB.open(); const num_accounts = await accountsDB.accounts.count(); if (num_accounts === 0) { - console.log("Problem! Should have a profile!"); + console.error("Problem! Should have a profile!"); } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === this.activeDid, accounts); diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 1e10e68c..5af2fdf9 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -175,7 +175,6 @@ export default class ProjectViewView extends Vue { const route = { name: "new-edit-project", }; - console.log(route); this.$router.push(route); } @@ -200,7 +199,6 @@ export default class ProjectViewView extends Vue { try { const resp = await this.axios.get(url, { headers }); - console.log("resp.status, resp.data", resp.status, resp.data); if (resp.status === 200) { const startTime = resp.data.startTime; if (startTime != null) { @@ -223,7 +221,7 @@ export default class ProjectViewView extends Vue { this.errorMessage = "Something went wrong retrieving that project." + " See logs for more info."; - console.log("Error retrieving project:", error); + console.error("Error retrieving project:", error); } } } @@ -238,7 +236,7 @@ export default class ProjectViewView extends Vue { await accountsDB.open(); const num_accounts = await accountsDB.accounts.count(); if (num_accounts === 0) { - console.log("Problem! Should have a profile!"); + console.error("Problem! Should have a profile!"); } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); diff --git a/src/views/ProjectsView.vue b/src/views/ProjectsView.vue index c91bdfea..f9dee844 100644 --- a/src/views/ProjectsView.vue +++ b/src/views/ProjectsView.vue @@ -117,12 +117,10 @@ export default class ProjectsView extends Vue { projects: { handleId: string; name: string; description: string }[] = []; onClickLoadProject(id: string) { - console.log("projectId", id); localStorage.setItem("projectId", id); const route = { name: "project", }; - console.log(route); this.$router.push(route); } @@ -151,7 +149,7 @@ export default class ProjectsView extends Vue { } } } catch (error) { - console.log(error); + console.error("Got error loading projects: ", error); } } @@ -165,7 +163,7 @@ export default class ProjectsView extends Vue { await accountsDB.open(); const num_accounts = await accountsDB.accounts.count(); if (num_accounts === 0) { - console.log("Problem! Should have a profile!"); + console.error("Problem! Should have a profile!"); } else { const accounts = await accountsDB.accounts.toArray(); const account = R.find((acc) => acc.did === activeDid, accounts); @@ -179,7 +177,6 @@ export default class ProjectsView extends Vue { const route = { name: "new-edit-project", }; - console.log(route); this.$router.push(route); } } diff --git a/src/views/SeedBackupView.vue b/src/views/SeedBackupView.vue index 5cc8f407..9ad683dc 100644 --- a/src/views/SeedBackupView.vue +++ b/src/views/SeedBackupView.vue @@ -122,7 +122,7 @@ export default class SeedBackupView extends Vue { const accounts = await accountsDB.accounts.toArray(); this.activeAccount = R.find((acc) => acc.did === activeDid, accounts); } catch (err) { - console.log("Got an error loading an identity:", err); + console.error("Got an error loading an identity:", err); this.alertTitle = "Error Loading Account"; this.alertMessage = "Got an error loading your seed data."; this.isAlertVisible = true;