Skip to content

Commit

Permalink
Better messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
toastdriven committed Jan 3, 2012
1 parent bc2cf1f commit b1c8c61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pyelasticsearch.py
Expand Up @@ -371,7 +371,7 @@ def create_index(self, index, settings=None, quiet=True):
except ElasticSearchError, e:
if not quiet:
raise
response = {"message": "Index '%s' already exists." % index}
response = {"message": "Create index '%s' errored: %s" % (index, e)}
return response

def delete_index(self, index, quiet=True):
Expand All @@ -383,7 +383,7 @@ def delete_index(self, index, quiet=True):
except ElasticSearchError, e:
if not quiet:
raise
response = {"message": "Index '%s' doesn't exist." % index}
response = {"message": "Delete index '%s' errored: %s" % (index, e)}
return response

def flush(self, indexes=['_all'], refresh=None):
Expand Down
2 changes: 1 addition & 1 deletion tests.py
Expand Up @@ -88,7 +88,7 @@ def testCannotCreateExistingIndex(self):
self.conn.create_index("another-index")
result = self.conn.create_index("another-index")
self.conn.delete_index("another-index")
self.assertEqual(result, {'message': "Index 'another-index' already exists."})
self.assertEqual(result, {'message': "Create index 'another-index' errored: Non-OK status code returned (400) containing u'IndexAlreadyExistsException[[another-index] Already exists]'."})
self.assertRaises(ElasticSearchError, self.conn.delete_index, "another-index", quiet=False)

def testPutMapping(self):
Expand Down

0 comments on commit b1c8c61

Please sign in to comment.