Skip to content

Commit

Permalink
Raising better error in get_design_document.
Browse files Browse the repository at this point in the history
  • Loading branch information
defcube committed Dec 14, 2012
1 parent effb673 commit eac0421
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion couchbase/rest_client.py
Expand Up @@ -31,6 +31,10 @@
log = logger("rest_client")


class DesignDocNotFoundError(Exception):
pass


#helper library methods built on top of RestConnection interface
class RestHelper(object):
def __init__(self, rest_connection):
Expand Down Expand Up @@ -207,7 +211,10 @@ def get_design_doc(self, bucket, design_doc):
json_parsed = json.loads(content)

if not status:
raise Exception("unable to get design doc")
if json_parsed['reason'] == 'missing':
raise DesignDocNotFoundError(json_parsed)
else:
raise Exception("unable to get design doc")

return json_parsed

Expand Down

0 comments on commit eac0421

Please sign in to comment.