From: Rob Golding Date: Tue, 5 Nov 2013 10:58:43 +0000 (+0000) Subject: Be a bit smarter about error messages X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/34f4f216b22b3cc778721807b206ecf940fe8cfe Be a bit smarter about error messages --- 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')