Skip to content

Commit 8c939d8

Browse files
committed
throw strapi error in data-import
1 parent 01da232 commit 8c939d8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • src/plugins/data-import/server/content-types/datafile

src/plugins/data-import/server/content-types/datafile/import.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const { ApplicationError } = require('@strapi/utils').errors;
34
const array = require('lodash/array');
45
const collection = require('lodash/collection');
56
const object = require('lodash/object');
@@ -22,10 +23,10 @@ const getEbiFieldData = async (data, ontology) => {
2223
({options} = res);
2324

2425
if (error) {
25-
throw new Error(error);
26+
throw new ApplicationError(error);
2627
}
2728
else if (!options || !options.length){
28-
throw new Error(`Provided data ${q} does not match to any ontology`);
29+
throw new ApplicationError(`Provided data ${q} does not match to any ontology`);
2930
}
3031

3132
if (label){
@@ -34,7 +35,7 @@ const getEbiFieldData = async (data, ontology) => {
3435
);
3536
}
3637
if (options.length > 1){
37-
throw new Error(`Provided data ${q} does not match to a single ontology`);
38+
throw new ApplicationError(`Provided data ${q} does not match to a single ontology`);
3839
}
3940

4041
return options[0];

0 commit comments

Comments
 (0)