From 34f4f216b22b3cc778721807b206ecf940fe8cfe Mon Sep 17 00:00:00 2001 From: Rob Golding Date: Tue, 5 Nov 2013 10:58:43 +0000 Subject: [PATCH 1/1] Be a bit smarter about error messages --- tasklib/task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasklib/task.py b/tasklib/task.py index e346f67..0546e44 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -254,7 +254,10 @@ class TaskWarrior(object): stderr=subprocess.PIPE) stdout, stderr = p.communicate() if p.returncode: - error_msg = stderr.strip().splitlines()[-1] + if stderr.strip(): + error_msg = stderr.strip().splitlines()[-1] + else: + error_msg = stdout.strip() raise TaskWarriorException(error_msg) return stdout.strip().split('\n') -- 2.39.5