From 31b1a5d78244605fcab024edc20e6a0c059e449f Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Wed, 6 Jul 2016 23:22:48 +0200 Subject: [PATCH] upgrade wakatime-cli to v6.0.7 --- plugin/packages/wakatime/__about__.py | 2 +- plugin/packages/wakatime/main.py | 14 +++++++++++++- plugin/packages/wakatime/projects/projectmap.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugin/packages/wakatime/__about__.py b/plugin/packages/wakatime/__about__.py index 003c493..f5f4317 100644 --- a/plugin/packages/wakatime/__about__.py +++ b/plugin/packages/wakatime/__about__.py @@ -1,7 +1,7 @@ __title__ = 'wakatime' __description__ = 'Common interface to the WakaTime api.' __url__ = 'https://github.com/wakatime/wakatime' -__version_info__ = ('6', '0', '6') +__version_info__ = ('6', '0', '7') __version__ = '.'.join(__version_info__) __author__ = 'Alan Hamlett' __author_email__ = 'alan@wakatime.com' diff --git a/plugin/packages/wakatime/main.py b/plugin/packages/wakatime/main.py index 2494fd3..c0969b3 100644 --- a/plugin/packages/wakatime/main.py +++ b/plugin/packages/wakatime/main.py @@ -187,7 +187,7 @@ def parseArguments(): # update args from configs if not args.hostname: if configs.has_option('settings', 'hostname'): - args.hostname = configs.get('settings', 'hostname') + args.hostname = configs.get('settings', 'hostname') if not args.key: default_key = None if configs.has_option('settings', 'api_key'): @@ -388,6 +388,18 @@ def send_heartbeat(project=None, branch=None, hostname=None, stats={}, key=None, log.warn(exception_data) else: log.error(exception_data) + + except: # delete cached session when requests raises unknown exception + exception_data = { + sys.exc_info()[0].__name__: u(sys.exc_info()[1]), + 'traceback': traceback.format_exc(), + } + if offline: + queue = Queue() + queue.push(data, json.dumps(stats), plugin) + log.warn(exception_data) + session_cache.delete() + else: code = response.status_code if response is not None else None content = response.text if response is not None else None diff --git a/plugin/packages/wakatime/projects/projectmap.py b/plugin/packages/wakatime/projects/projectmap.py index 5591a11..00e72f7 100644 --- a/plugin/packages/wakatime/projects/projectmap.py +++ b/plugin/packages/wakatime/projects/projectmap.py @@ -56,7 +56,7 @@ class ProjectMap(BaseProject): msg=u(ex), pattern=u(pattern), )) - except TypeError: # pragma: nocover + except TypeError: pass return None