Browse Source

prefer console.error messages for errors

kb/add-usage-guide
Trent Larson 2 years ago
parent
commit
32351b07b7
  1. 1
      project.task.yaml
  2. 5
      src/components/World/components/objects/landmarks.js
  3. 6
      src/views/AccountViewView.vue
  4. 4
      src/views/ContactAmountsView.vue
  5. 6
      src/views/ContactsView.vue
  6. 3
      src/views/ImportAccountView.vue
  7. 14
      src/views/NewEditProjectView.vue
  8. 6
      src/views/ProjectViewView.vue
  9. 7
      src/views/ProjectsView.vue
  10. 2
      src/views/SeedBackupView.vue

1
project.task.yaml

@ -7,7 +7,6 @@
- replace user-affecting console.log & console.error with error messages (eg. catches) - replace user-affecting console.log & console.error with error messages (eg. catches)
- stats v1 : - stats v1 :
- use all bits of randomness for location
- 01 show numeric stats - 01 show numeric stats
- 01 link to world for specific stats - 01 link to world for specific stats

5
src/components/World/components/objects/landmarks.js

@ -4,7 +4,6 @@ import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader";
import * as SkeletonUtils from "three/addons/utils/SkeletonUtils"; import * as SkeletonUtils from "three/addons/utils/SkeletonUtils";
import * as TWEEN from "@tweenjs/tween.js"; import * as TWEEN from "@tweenjs/tween.js";
import { AppString } from "@/constants/app";
import { accountsDB, db } from "@/db"; import { accountsDB, db } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto"; import { accessToken } from "@/libs/crypto";
@ -118,7 +117,7 @@ export async function loadLandmarks(vue, world, scene, loop) {
world.lights = [...world.lights, light]; world.lights = [...world.lights, light];
} }
} else { } else {
console.log( console.error(
"Got bad server response status & data of", "Got bad server response status & data of",
resp.status, resp.status,
resp.data resp.data
@ -129,7 +128,7 @@ export async function loadLandmarks(vue, world, scene, loop) {
); );
} }
} catch (error) { } catch (error) {
console.log("Got exception contacting server:", error); console.error("Got exception contacting server:", error);
vue.setAlert( vue.setAlert(
"Error With Server", "Error With Server",
"There was a problem retrieving your claims from the server." "There was a problem retrieving your claims from the server."

6
src/views/AccountViewView.vue

@ -437,7 +437,7 @@ export default class AccountViewView extends Vue {
} catch (err) { } catch (err) {
this.alertMessage = this.alertMessage =
"Clear your cache and start over (after data backup). See console log for more info."; "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.alertTitle = "Error Creating Account";
this.isAlertVisible = true; this.isAlertVisible = true;
} }
@ -452,7 +452,7 @@ export default class AccountViewView extends Vue {
} catch (err) { } catch (err) {
this.alertMessage = this.alertMessage =
"Clear your cache and start over (after data backup). See console log for more info."; "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.alertTitle = "Error Creating Account";
this.isAlertVisible = true; this.isAlertVisible = true;
} }
@ -503,7 +503,7 @@ export default class AccountViewView extends Vue {
const serverError = error as AxiosError; const serverError = error as AxiosError;
this.alertTitle = "Error from Server"; 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? // Anybody know how to access items inside "response.data" without this?
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const data: any = serverError.response?.data; const data: any = serverError.response?.data;

4
src/views/ContactAmountsView.vue

@ -189,7 +189,7 @@ export default class ContactsView extends Vue {
if (resp.status === 200) { if (resp.status === 200) {
result = resp.data.data; result = resp.data.data;
} else { } else {
console.log( console.error(
"Got bad response status & data of", "Got bad response status & data of",
resp.status, resp.status,
resp.data resp.data
@ -215,7 +215,7 @@ export default class ContactsView extends Vue {
if (resp2.status === 200) { if (resp2.status === 200) {
result = R.concat(result, resp2.data.data); result = R.concat(result, resp2.data.data);
} else { } else {
console.log( console.error(
"Got bad response status & data of", "Got bad response status & data of",
resp2.status, resp2.status,
resp2.data resp2.data

6
src/views/ContactsView.vue

@ -362,7 +362,7 @@ export default class ContactsView extends Vue {
this.givenByMeConfirmed = contactConfirmed; this.givenByMeConfirmed = contactConfirmed;
this.givenByMeUnconfirmed = contactUnconfirmed; this.givenByMeUnconfirmed = contactUnconfirmed;
} else { } else {
console.log( console.error(
"Got bad response status & data of", "Got bad response status & data of",
resp.status, resp.status,
resp.data resp.data
@ -416,7 +416,7 @@ export default class ContactsView extends Vue {
this.givenToMeConfirmed = contactConfirmed; this.givenToMeConfirmed = contactConfirmed;
this.givenToMeUnconfirmed = contactUnconfirmed; this.givenToMeUnconfirmed = contactUnconfirmed;
} else { } else {
console.log( console.error(
"Got bad response status & data of", "Got bad response status & data of",
resp.status, resp.status,
resp.data resp.data
@ -583,7 +583,7 @@ export default class ContactsView extends Vue {
db.contacts.update(contact.did, { seesMe: visibility }); db.contacts.update(contact.did, { seesMe: visibility });
} else { } else {
this.alertTitle = "Error With Server"; 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) { if (resp.data.error?.message) {
this.alertMessage = resp.data.error?.message; this.alertMessage = resp.data.error?.message;
} else { } else {

3
src/views/ImportAccountView.vue

@ -93,8 +93,7 @@ export default class ImportAccountView extends Vue {
}); });
this.$router.push({ name: "account" }); this.$router.push({ name: "account" });
} catch (err) { } catch (err) {
console.log("Error!"); console.error("Error saving mnemonic & updating settings:", err);
console.log(err);
} }
} }
} }

14
src/views/NewEditProjectView.vue

@ -122,7 +122,7 @@ export default class NewEditProjectView extends Vue {
await accountsDB.open(); await accountsDB.open();
const num_accounts = await accountsDB.accounts.count(); const num_accounts = await accountsDB.accounts.count();
if (num_accounts === 0) { if (num_accounts === 0) {
console.log("Problem! Should have a profile!"); console.error("Problem! Should have a profile!");
} else { } else {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === this.activeDid, accounts); const account = R.find((acc) => acc.did === this.activeDid, accounts);
@ -145,14 +145,13 @@ export default class NewEditProjectView extends Vue {
try { try {
const resp = await this.axios.get(url, { headers }); const resp = await this.axios.get(url, { headers });
console.log(resp.status, resp.data);
if (resp.status === 200) { if (resp.status === 200) {
const claim = resp.data.claim; const claim = resp.data.claim;
this.projectName = claim.name; this.projectName = claim.name;
this.description = claim.description; this.description = claim.description;
} }
} catch (error) { } catch (error) {
console.log(error); console.error("Got error retrieving that project", error);
} }
} }
@ -200,7 +199,6 @@ export default class NewEditProjectView extends Vue {
try { try {
const resp = await this.axios.post(url, payload, { headers }); 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 // handleId is new in server v release-1.6.0; remove fullIri when that
// version shows up here: https://endorser.ch:3000/api-docs/ // version shows up here: https://endorser.ch:3000/api-docs/
if (resp.data?.success?.handleId || resp.data?.success?.fullIri) { if (resp.data?.success?.handleId || resp.data?.success?.fullIri) {
@ -217,7 +215,6 @@ export default class NewEditProjectView extends Vue {
const route = { const route = {
name: "project", name: "project",
}; };
console.log(route);
that.$router.push(route); that.$router.push(route);
}, },
2000, 2000,
@ -238,7 +235,10 @@ export default class NewEditProjectView extends Vue {
this.alertMessage = JSON.stringify(serverError.toJSON()); this.alertMessage = JSON.stringify(serverError.toJSON());
} }
} else { } 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.alertTitle = "Claim Error";
this.alertMessage = error as string; this.alertMessage = error as string;
} }
@ -254,7 +254,7 @@ export default class NewEditProjectView extends Vue {
await accountsDB.open(); await accountsDB.open();
const num_accounts = await accountsDB.accounts.count(); const num_accounts = await accountsDB.accounts.count();
if (num_accounts === 0) { if (num_accounts === 0) {
console.log("Problem! Should have a profile!"); console.error("Problem! Should have a profile!");
} else { } else {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === this.activeDid, accounts); const account = R.find((acc) => acc.did === this.activeDid, accounts);

6
src/views/ProjectViewView.vue

@ -175,7 +175,6 @@ export default class ProjectViewView extends Vue {
const route = { const route = {
name: "new-edit-project", name: "new-edit-project",
}; };
console.log(route);
this.$router.push(route); this.$router.push(route);
} }
@ -200,7 +199,6 @@ export default class ProjectViewView extends Vue {
try { try {
const resp = await this.axios.get(url, { headers }); const resp = await this.axios.get(url, { headers });
console.log("resp.status, resp.data", resp.status, resp.data);
if (resp.status === 200) { if (resp.status === 200) {
const startTime = resp.data.startTime; const startTime = resp.data.startTime;
if (startTime != null) { if (startTime != null) {
@ -223,7 +221,7 @@ export default class ProjectViewView extends Vue {
this.errorMessage = this.errorMessage =
"Something went wrong retrieving that project." + "Something went wrong retrieving that project." +
" See logs for more info."; " 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(); await accountsDB.open();
const num_accounts = await accountsDB.accounts.count(); const num_accounts = await accountsDB.accounts.count();
if (num_accounts === 0) { if (num_accounts === 0) {
console.log("Problem! Should have a profile!"); console.error("Problem! Should have a profile!");
} else { } else {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts); const account = R.find((acc) => acc.did === activeDid, accounts);

7
src/views/ProjectsView.vue

@ -117,12 +117,10 @@ export default class ProjectsView extends Vue {
projects: { handleId: string; name: string; description: string }[] = []; projects: { handleId: string; name: string; description: string }[] = [];
onClickLoadProject(id: string) { onClickLoadProject(id: string) {
console.log("projectId", id);
localStorage.setItem("projectId", id); localStorage.setItem("projectId", id);
const route = { const route = {
name: "project", name: "project",
}; };
console.log(route);
this.$router.push(route); this.$router.push(route);
} }
@ -151,7 +149,7 @@ export default class ProjectsView extends Vue {
} }
} }
} catch (error) { } 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(); await accountsDB.open();
const num_accounts = await accountsDB.accounts.count(); const num_accounts = await accountsDB.accounts.count();
if (num_accounts === 0) { if (num_accounts === 0) {
console.log("Problem! Should have a profile!"); console.error("Problem! Should have a profile!");
} else { } else {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts); const account = R.find((acc) => acc.did === activeDid, accounts);
@ -179,7 +177,6 @@ export default class ProjectsView extends Vue {
const route = { const route = {
name: "new-edit-project", name: "new-edit-project",
}; };
console.log(route);
this.$router.push(route); this.$router.push(route);
} }
} }

2
src/views/SeedBackupView.vue

@ -122,7 +122,7 @@ export default class SeedBackupView extends Vue {
const accounts = await accountsDB.accounts.toArray(); const accounts = await accountsDB.accounts.toArray();
this.activeAccount = R.find((acc) => acc.did === activeDid, accounts); this.activeAccount = R.find((acc) => acc.did === activeDid, accounts);
} catch (err) { } 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.alertTitle = "Error Loading Account";
this.alertMessage = "Got an error loading your seed data."; this.alertMessage = "Got an error loading your seed data.";
this.isAlertVisible = true; this.isAlertVisible = true;

Loading…
Cancel
Save