Skip to content

Commit

Permalink
feat(errors): improved error message for indices.exists (#129)
Browse files Browse the repository at this point in the history
See pelias/docker#217

Currently users are seeing "elasticsearch index pelias does not exist"
even though it does.

This could happen if an error is encountered while making the request.
We should print a more useful error message in that case.
  • Loading branch information
michaelkirk authored Jun 18, 2024
1 parent b67ee4b commit e95e08a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/configValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ module.exports = {

// callback that throws an error if the index doesn't exist
const existsCallback = (error, exists) => {
if (error) {
console.error(`ERROR: Failed to check if Elasticsearch index ${config.schema.indexName} exists.`);
console.error('For full instructions on setting up Pelias, see http://pelias.io/install.html');
throw error;
}

if (!exists) {
console.error(`ERROR: Elasticsearch index ${config.schema.indexName} does not exist`);
console.error('You must use the pelias-schema tool (https://github.com/pelias/schema/) to create the index first');
Expand Down

0 comments on commit e95e08a

Please sign in to comment.