Skip to content

Commit

Permalink
Merge pull request #1333 from cassproject/ce-1243.1
Browse files Browse the repository at this point in the history
Catch error during json-ld import
  • Loading branch information
gloverkari authored Sep 29, 2023
2 parents 5cdc464 + 3342b05 commit dee4e72
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/mixins/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,12 @@ export default {
}
}, false, me.repo);
},
importJsonLd: function(data) {
importJsonLd: function(importData) {
return new Promise((resolve, reject) => {
this.$store.commit('app/importTransition', 'process');
var formData = new FormData();
if (data != null && data !== undefined) {
formData.append('data', JSON.stringify(data));
if (importData != null && importData !== undefined) {
formData.append('data', JSON.stringify(importData));
} else {
var file = this.importFile[0];
formData.append('file', file);
Expand Down Expand Up @@ -903,6 +903,12 @@ export default {
appLog(failure.statusText);
me.$store.commit('app/addImportError', failure);
reject(failure.statusText);
}).catch((err) => {
me.$store.commit('app/importTransition', 'process');
me.$store.commit('app/importStatus', "Import failed. Check your import file for any errors.");
appLog(err);
me.$store.commit('app/addImportError', err);
reject(err);
});
if (me.conceptMode || me.progressionMode) {
if (me.importFileType === 'ctdlasnjsonldprogression') {
Expand Down

0 comments on commit dee4e72

Please sign in to comment.