Browse Source

enhance error messages

pull/97/head
Trent Larson 12 months ago
parent
commit
5db3423301
  1. 24
      src/App.vue
  2. 28
      src/views/ContactsView.vue

24
src/App.vue

@ -328,16 +328,20 @@ export default class App extends Vue {
); );
} }
} catch (error) { } catch (error) {
console.error("Got an error initializing notifications:", error); if (window.location.host.startsWith("localhost")) {
this.$notify( console.log("Ignoring this error getting VAPID for local development:", error);
{ } else {
group: "alert", console.error("Got an error initializing notifications:", error);
type: "danger", this.$notify(
title: "Error Setting Notifications", {
text: "Got an error setting notifications.", group: "alert",
}, type: "danger",
-1, title: "Error Setting Notifications",
); text: "Got an error setting notifications.",
},
-1,
);
}
} }
} }

28
src/views/ContactsView.vue

@ -401,7 +401,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Retrieval Error",
text: text:
"Got an error retrieving your " + "Got an error retrieving your " +
(useRecipient ? "given" : "received") + (useRecipient ? "given" : "received") +
@ -456,12 +456,13 @@ export default class ContactsView extends Vue {
this.givenToMeConfirmed = givenToMeConfirmed; this.givenToMeConfirmed = givenToMeConfirmed;
this.givenToMeUnconfirmed = givenToMeUnconfirmed; this.givenToMeUnconfirmed = givenToMeUnconfirmed;
} catch (error) { } catch (error) {
console.log("Error loading gives", error);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Load Error",
text: error as string, text: "Got an error loading your givcs.",
}, },
-1, -1,
); );
@ -705,6 +706,7 @@ export default class ContactsView extends Vue {
); );
} }
} catch (error) { } catch (error) {
console.error("Error when registering:", error);
let userMessage = "There was an error. See logs for more info."; let userMessage = "There was an error. See logs for more info.";
const serverError = error as AxiosError; const serverError = error as AxiosError;
if (serverError) { if (serverError) {
@ -721,7 +723,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Registration Error",
text: userMessage, text: userMessage,
}, },
-1, -1,
@ -767,27 +769,28 @@ export default class ContactsView extends Vue {
} else { } else {
console.error( console.error(
"Got some bad server response when setting visibility: ", "Got some bad server response when setting visibility: ",
resp.status,
resp, resp,
); );
const message = const message =
resp.data.error?.message || "Bad server response of " + resp.status; resp.data.error?.message || "Got some error setting visibility.";
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Error Setting Visibility",
text: message, text: message,
}, },
-1, -1,
); );
} }
} catch (err) { } catch (err) {
console.error("Got some server error when setting visibility:", err); console.error("Got some error when setting visibility:", err);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Error Setting Visibility",
text: "Check connectivity and try again.", text: "Check connectivity and try again.",
}, },
-1, -1,
@ -830,19 +833,19 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Error Checking Visibility",
text: message, text: message,
}, },
-1, -1,
); );
} }
} catch (err) { } catch (err) {
console.log("Caught error from server request to check visibility:", err); console.log("Caught error from request to check visibility:", err);
this.$notify( this.$notify(
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Error Checking Visibility",
text: "Check connectivity and try again.", text: "Check connectivity and try again.",
}, },
-1, -1,
@ -1028,6 +1031,7 @@ export default class ContactsView extends Vue {
} }
} }
} catch (error) { } catch (error) {
console.log("Error in createAndSubmitGive: ", error);
let userMessage = "There was an error. See logs for more info."; let userMessage = "There was an error. See logs for more info.";
const serverError = error as AxiosError; const serverError = error as AxiosError;
if (serverError) { if (serverError) {
@ -1044,7 +1048,7 @@ export default class ContactsView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Server Error", title: "Error Sending Give",
text: userMessage, text: userMessage,
}, },
-1, -1,

Loading…
Cancel
Save