From 5b6c59c23245c81b9cf15545b9dc9d5d87d093ed Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 23 May 2025 11:09:22 -0600 Subject: [PATCH] show an error if the import goes badly --- src/views/AccountViewView.vue | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 2efff7e1..c944e847 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -976,6 +976,7 @@ import { AxiosError } from "axios"; import { Buffer } from "buffer/"; import Dexie from "dexie"; import "dexie-export-import"; +// @ts-ignore - they aren't exporting it but it's there import { ImportProgress } from "dexie-export-import"; import { LeafletMouseEvent } from "leaflet"; import * as R from "ramda"; @@ -1621,10 +1622,24 @@ export default class AccountViewView extends Vue { */ async submitImportFile() { if (inputImportFileNameRef.value != null) { - await db.delete(); - await Dexie.import(inputImportFileNameRef.value as Blob, { - progressCallback: this.progressCallback, - }); + await db.delete() + .then(async () => { + await Dexie.import(inputImportFileNameRef.value as Blob, { + progressCallback: this.progressCallback, + }) + }) + .catch((error) => { + logger.error("Error importing file:", error); + this.$notify( + { + group: "alert", + type: "danger", + title: "Error Importing", + text: "There was an error importing that file. Your contacts may have been affected, so you may want to use the other import method.", + }, + 5000, + ); + }); } }