add more debug information on errors caught from server

This commit is contained in:
2024-12-28 16:29:57 -07:00
parent 6c5001ac41
commit caf46ab383
4 changed files with 58 additions and 13 deletions

View File

@@ -326,6 +326,7 @@ import TopMessage from "@/components/TopMessage.vue";
import { APP_SERVER, AppString, NotificationIface } from "@/constants/app";
import {
db,
logConsoleAndDb,
retrieveSettingsForActiveAccount,
updateAccountSettings,
updateDefaultSettings,
@@ -337,6 +338,7 @@ import {
CONTACT_CSV_HEADER,
CONTACT_URL_PREFIX,
createEndorserJwtForDid,
errorStringForLog,
GiveSummaryRecord,
getHeaders,
isDid,
@@ -511,7 +513,8 @@ export default class ContactsView extends Vue {
);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
console.error("Error redeeming invite:", error);
const fullError = "Error redeeming invite: " + errorStringForLog(error);
logConsoleAndDb(fullError, true);
let message = "Got an error sending the invite.";
if (
error.response &&
@@ -670,7 +673,8 @@ export default class ContactsView extends Vue {
this.givenToMeConfirmed = givenToMeConfirmed;
this.givenToMeUnconfirmed = givenToMeUnconfirmed;
} catch (error) {
console.error("Error loading gives", error);
const fullError = "Error loading gives: " + errorStringForLog(error);
logConsoleAndDb(fullError, true);
this.$notify(
{
group: "alert",
@@ -719,6 +723,9 @@ export default class ContactsView extends Vue {
3000, // keeping it up so that the "visibility" message is seen
);
} catch (e) {
const fullError =
"Error adding contacts from CSV: " + errorStringForLog(e);
logConsoleAndDb(fullError, true);
this.danger("An error occurred. Some contacts may have been added.");
}
@@ -785,6 +792,9 @@ export default class ContactsView extends Vue {
query: { contacts: JSON.stringify(contacts) },
});
} catch (e) {
const fullError =
"Error adding contacts from array: " + errorStringForLog(e);
logConsoleAndDb(fullError, true);
this.danger("The input could not be parsed.", "Invalid Contact List");
}
return;
@@ -934,7 +944,9 @@ export default class ContactsView extends Vue {
);
})
.catch((err) => {
console.error("Error when adding contact to storage:", err);
const fullError =
"Error when adding contact to storage: " + errorStringForLog(err);
logConsoleAndDb(fullError, true);
let message = "An error prevented this import.";
if (
err.message?.indexOf("Key already exists in the object store.") > -1
@@ -1011,7 +1023,8 @@ export default class ContactsView extends Vue {
);
}
} catch (error) {
console.error("Error when registering:", error);
const fullError = "Error when registering: " + errorStringForLog(error);
logConsoleAndDb(fullError, true);
let userMessage = "There was an error.";
const serverError = error as AxiosError;
if (serverError.isAxiosError) {
@@ -1197,6 +1210,9 @@ export default class ContactsView extends Vue {
showContactGivesInline: newShowValue,
});
} catch (err) {
const fullError =
"Error updating contact-amounts setting: " + errorStringForLog(err);
logConsoleAndDb(fullError, true);
this.$notify(
{
group: "alert",
@@ -1206,10 +1222,6 @@ export default class ContactsView extends Vue {
},
5000,
);
console.error(
"Telling user to try again after contact-amounts setting update because:",
err,
);
}
this.showGiveNumbers = newShowValue;
if (