Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

improve error handling

  • Loading branch information...
commit 77d4c04400696741595606b53c44ad81368b4094 1 parent b432d10
Pavel Paulau authored

Showing 1 changed file with 11 additions and 7 deletions. Show diff stats Hide diff stats

  1. +11 7 btrc
18 btrc
@@ -21,13 +21,17 @@ class CouchbaseClient(object):
21 21 try:
22 22 r = requests.get(url).json
23 23 except requests.exceptions.ConnectionError:
24   - sys.exit('Wrong hostname')
25   - for node in r['nodes']:
26   - hostname, port = node['hostname'].split(':')
27   - if port == '8091':
28   - yield hostname + ':8092'
29   - else:
30   - yield hostname + ':9500'
  24 + sys.exit(
  25 + 'Cannot establish connection with specified [host:port] node')
  26 + if r is not None:
  27 + for node in r['nodes']:
  28 + hostname, port = node['hostname'].split(':')
  29 + if port == '8091':
  30 + yield hostname + ':8092'
  31 + else:
  32 + yield hostname + ':9500'
  33 + else:
  34 + sys.exit('Node has no buckets/misconfigured')
31 35
32 36 def _get_list_of_ddocs(self):
33 37 """Yield names of design documents in specified bucket"""

0 comments on commit 77d4c04

Please sign in to comment.
Something went wrong with that request. Please try again.