Skip to content

Commit

Permalink
fix doc status logging warning, ver bump
Browse files Browse the repository at this point in the history
  • Loading branch information
jobelenus committed Sep 30, 2016
1 parent e090055 commit 98bb363
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyavatax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (1, 3, 6)
VERSION = (1, 3, 7)


def get_version():
Expand Down
12 changes: 6 additions & 6 deletions pyavatax/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ def error_as_resp(args, e):
self = args[0] # the first arg is self
logged = False
try:
# but don't log the doc status error as an exception
error_as_json = json.loads(e.full_request_as_string)
if 'DocStatus' in error_as_json:
if error_as_json == 'DocStatus is invalid for this operation.':
self.logger.warning(e.full_request_as_string) # this case is not an error, just log a warning
logged = True
# don't log the doc status error as an exception
for err in e.error_as_dict:
if 'DocStatus' in err.keys():
if 'DocStatus is invalid for this operation.' in err.values():
self.logger.warning(e.full_request_as_string) # this case is not an error, just log a warning
logged = True

if not logged:
self.logger.exception(e.full_request_as_string)
Expand Down
4 changes: 4 additions & 0 deletions pyavatax/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ def full_request_as_string(self):
fmt = "Status: %r \n Method: %r, \n URL: %r \n Data: %r \n Errors: %r "
return fmt % (repr(self.status_code), repr(self.method), repr(self.url), repr(self.request_data), repr(self.errors))

@property
def errors_as_dict(self):
return self.errors

@property
def errors(self):
"""Will return an ErrorResponse details property, or the raw text server response"""
Expand Down

0 comments on commit 98bb363

Please sign in to comment.