Skip to content

Commit

Permalink
Added Show error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunihiko Kido committed May 7, 2015
1 parent a5bf3ed commit 79d4675
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/elasticsearch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sublime
import requests
from .cat import CatClient
from .indices import IndicesClient
Expand Down Expand Up @@ -25,8 +26,13 @@ def request(self, method, path, body=None, params=None):
if body is not None:
body = body.encode('utf-8')

response = requests.request(
method.lower(), url, data=body, headers=self.headers)
try:
response = requests.request(
method.lower(), url, data=body, headers=self.headers)
except requests.exceptions.RequestException as e:
import sys
sublime.error_message("Error: {0!s}".format(e))
sys.exit(1)

return response

Expand Down

0 comments on commit 79d4675

Please sign in to comment.