Skip to content

Commit 5d37086

Browse files
committed
Replace finally with catch-then for compatibility (#321)
1 parent bb0a7b7 commit 5d37086

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

src/MappingsApp.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ export default {
574574
}).catch(error => {
575575
console.warn("Error fetching mapping schemes:", error)
576576
this.concordances = []
577-
}).finally(() => {
577+
}).then(() => {
578578
// If there are no concordances, jump to second tab.
579579
if (this.concordances.length == 0 && this.tab == 0) {
580580
this.tab = 1

src/components/MappingBrowser.vue

+7-3
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ export default {
11301130
11311131
}
11321132
1133-
Promise.all(promises).finally(() => {
1133+
Promise.all(promises).then(() => {
11341134
if (this.loadingId == loadingId) {
11351135
// Reset loading ID
11361136
this.loading = 0
@@ -1225,7 +1225,9 @@ export default {
12251225
}
12261226
// Refresh list of mappings/suggestions.
12271227
this.$store.commit("mapping/setRefresh", { registry: _.get(this.currentRegistry, "uri") })
1228-
}).finally(() => {
1228+
}).catch(error => {
1229+
console.error("MappingBrowser - error in removeMapping:", error)
1230+
}).then(() => {
12291231
this.loadingGlobal = false
12301232
})
12311233
},
@@ -1275,7 +1277,9 @@ export default {
12751277
this.alert(message, null, "danger")
12761278
}
12771279
return mapping
1278-
}).finally(() => {
1280+
}).catch(error => {
1281+
console.error("MappingBrowser - error in saveMapping:", error)
1282+
}).then(() => {
12791283
this.loadingGlobal = false
12801284
// Refresh list of mappings/suggestions.
12811285
this.$store.commit("mapping/setRefresh", { registry: _.get(this.currentRegistry, "uri") })

src/components/MappingEditor.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ export default {
440440
if (this.clearOnSave) {
441441
this.clearMapping()
442442
}
443-
}).finally(() => {
443+
}).catch(error => {
444+
console.error("MappingEditor - error in saveMapping:", error)
445+
}).then(() => {
444446
this.loadingGlobal = false
445447
this.$store.commit("mapping/setRefresh", { registry: _.get(this.$store.getters.getCurrentRegistry, "uri") })
446448
})
@@ -477,7 +479,9 @@ export default {
477479
} else {
478480
this.alert(this.$t("alerts.mappingNotDeleted"), null, "danger")
479481
}
480-
}).finally(() => {
482+
}).catch(error => {
483+
console.error("MappingEditor - error in deleteOriginalMapping:", error)
484+
}).then(() => {
481485
this.loadingGlobal = false
482486
})
483487
return true

src/providers/local-mappings-provider.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ class LocalMappingsProvider extends BaseProvider {
165165
localMappings = localMappings.map(mapping => jskos.minifyMapping(mapping))
166166
return localforage.setItem(this.localStorageKey, localMappings).then(() => {
167167
return mapping
168-
}).catch(() => {
168+
}).catch(error => {
169+
console.error("local-mappings - error in saveMapping:", error)
169170
return null
170-
}).finally(mapping => {
171+
}).then(mapping => {
171172
done()
172173
return mapping
173174
})
@@ -193,9 +194,10 @@ class LocalMappingsProvider extends BaseProvider {
193194
localMappings = localMappings.map(mapping => jskos.minifyMapping(mapping))
194195
return localforage.setItem(this.localStorageKey, localMappings).then(() => {
195196
return mapping
196-
}).catch(() => {
197+
}).catch(error => {
198+
console.error("local-mappings - error in removeMapping:", error)
197199
return null
198-
}).finally(mapping => {
200+
}).then(mapping => {
199201
done()
200202
return mapping
201203
})

0 commit comments

Comments
 (0)