From 4017ab99e0dededcaef60839c93e12dc5885bd5d Mon Sep 17 00:00:00 2001 From: Rob Golding Date: Tue, 5 Nov 2013 17:47:27 +0000 Subject: [PATCH 1/1] Raise TaskWarriorException on invalid JSON --- tasklib/task.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tasklib/task.py b/tasklib/task.py index c267048..280f961 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -266,7 +266,11 @@ class TaskWarrior(object): tasks = [] for line in self.execute_command(args): if line: - tasks.append(Task(self, json.loads(line.strip(',')))) + data = line.strip(',') + try: + tasks.append(Task(self, json.loads(data))) + except ValueError: + raise TaskWarriorException('Invalid JSON: %s' % data) return tasks def merge_with(self, path, push=False): -- 2.39.5