From 11070755d6ec4894c509f116a7949ccdf53fe223 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 29 Dec 2023 13:10:07 -0700 Subject: [PATCH] refine error message when duplicate contact is input --- src/views/ContactsView.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index 01df405b3..e0a2f140a 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -587,12 +587,19 @@ export default class ContactsView extends Vue { }) .catch((err) => { console.error("Error when adding contact to storage:", err); + let message = "An error prevented this import."; + if ( + err.message?.indexOf("Key already exists in the object store.") > -1 + ) { + message = + "A contact with that DID is already in your contact list. Edit them directly below."; + } this.$notify( { group: "alert", type: "danger", title: "Contact Not Added", - text: "An error prevented this import.", + text: message, }, -1, );