Skip to content

Commit

Permalink
revert to initial error and added message log when the error occurs s…
Browse files Browse the repository at this point in the history
…o that we can have more detail when exploring bugs
  • Loading branch information
etrousset committed Nov 14, 2023
1 parent 6c2f7ce commit 7782b70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kerror/codes/1-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"class": "BadRequestError"
},
"unknown_index_collection": {
"description": "The provided index and/or collection doesn't exist",
"description": "The provided index and/or collection doesn't exist: \"%s\"",
"code": 16,
"message": "The provided index and/or collection doesn't exist.",
"class": "PreconditionError"
Expand Down
5 changes: 4 additions & 1 deletion lib/service/storage/elasticsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const scopeEnum = require("../../core/storage/storeScopeEnum");
const extractFields = require("../../util/extractFields");
const { Mutex } = require("../../util/mutex");
const { randomNumber } = require("../../util/name-generator");
const { error } = require("console");

Check failure on line 43 in lib/service/storage/elasticsearch.js

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

'error' is assigned a value but never used

Check failure on line 43 in lib/service/storage/elasticsearch.js

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

'error' is assigned a value but never used

const SCROLL_CACHE_PREFIX = "_docscroll_";

Expand Down Expand Up @@ -2965,7 +2966,9 @@ class ElasticSearch extends Service {
});

if (body.length < 1) {
throw kerror.get(`unknown_index_collection : ${alias}`);
const getIndiceError = kerror.get("unknown_index_collection");
debug(`${getIndiceError.message} : alias = ${alias}` );
throw getIndiceError;
} else if (body.length > 1) {
throw kerror.get(
"multiple_indice_alias",
Expand Down

0 comments on commit 7782b70

Please sign in to comment.