Browse Source

enhance error messages

home-infinite
Trent Larson 11 months ago
parent
commit
5db3423301
  1. 4
      src/App.vue
  2. 28
      src/views/ContactsView.vue

4
src/App.vue

@ -328,6 +328,9 @@ export default class App extends Vue {
); );
} }
} catch (error) { } catch (error) {
if (window.location.host.startsWith("localhost")) {
console.log("Ignoring this error getting VAPID for local development:", error);
} else {
console.error("Got an error initializing notifications:", error); console.error("Got an error initializing notifications:", error);
this.$notify( this.$notify(
{ {
@ -340,6 +343,7 @@ export default class App extends Vue {
); );
} }
} }
}
private sendMessageToServiceWorker( private sendMessageToServiceWorker(
message: ServiceWorkerMessage, message: ServiceWorkerMessage,

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