Skip to content

Commit

Permalink
0.9.2-1 - traceback/stack trace login in hcpsdk.Connection.request()
Browse files Browse the repository at this point in the history
Changed:
hcpsdk.Connection.request() now logs exception information
and stack trace if a catch'd exception is re-raised as an
hcpsdk.*Error. This will get visible only if the application
has initialized the logging subsystem.
Added:      -
Fixed:      -
  • Loading branch information
Simont3 committed Mar 1, 2015
1 parent 3b07a5c commit 560fa5b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
23 changes: 23 additions & 0 deletions src/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
0.9.2-1 2015-03-01
------------------
Changed: hcpsdk.Connection.request() now logs exception information
and stack trace if a catch'd exception is re-raised as an
hcpsdk.*Error. This will get visible only if the application
has initialized the logging subsystem.
Added: -
Fixed: -

0.9.1-8 2015-02-27
------------------
Changed: -
Added: -
Fixed: Fixed line width in documeantion (.rst files) to match
limitations for pdf generation

0.9.1-7 2015-02-27
------------------
Changed: -
Added: -
Fixed: pip distribution fixed to allow auto-install of dependencies
when running 'pip install hcpsdk'

0.9.1-6 2015-02-18
------------------
Changed: -
Expand Down
13 changes: 9 additions & 4 deletions src/hcpsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,13 @@ def request(self, method, url, body=None, params=None, headers=None):
our self again...
"""
if not initialretry:
self.logger.log(logging.DEBUG, 'Connection needs to be opened')
self.logger.log(logging.WARNING, 'Connection needs to be opened',
exc_info=True, stack_info=True)
initialretry = True
continue
else:
raise HcpsdkError('Not connected, retry failed ({})'.format(str(e)))
raise HcpsdkError('Not connected, retry failed ({})'
.format(str(e)))
except ssl.SSLError as e:
self.logger.log(logging.DEBUG, 'ssl.SSLError: {}'.format(str(e)))
raise HcpsdkCertificateError(str(e))
Expand All @@ -463,10 +465,13 @@ def request(self, method, url, body=None, params=None, headers=None):
self.close()
raise HcpsdkTimeoutError('Timeout ({} retries) - {}'.format(retries, url))
except http.client.HTTPException as e:
self.logger.log(logging.DEBUG, 'http.client.HTTPException: {}'.format(str(e)))
self.logger.log(logging.WARNING, 'http.client.HTTPException: {}'
.format(str(e)),
exc_info=True, stack_info=True)
raise e
except Exception as e:
self.logger.log(logging.DEBUG, 'Exception: {}'.format(str(e)))
self.logger.log(logging.WARNING, 'Exception: {}'.format(str(e)),
exc_info=True, stack_info=True)
raise HcpsdkError(str(e))
else:
try:
Expand Down
4 changes: 2 additions & 2 deletions src/hcpsdk/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class _Version(object):
"""
release = 0
major = 9
minor = 1
build = 8
minor = 2
build = 1

fullversion = '{}.{}.{}-{}'.format(release, major, minor, build)

Expand Down

0 comments on commit 560fa5b

Please sign in to comment.