aboutsummaryrefslogtreecommitdiff
path: root/modules/todo.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-16 15:09:58 +0100
committerGravatar jesopo2018-10-16 15:09:58 +0100
commit773d11f6cbaa8da91185547b0ab67f3706d735c2 (patch)
treec46eb6709985ef7cdfb5bfe9b035fdbdedc4f91f /modules/todo.py
parentOnly log exceptions when they're not unsafe (diff)
Change all instances of stdout.write+return to `raise utils.EventError` in
modules
Diffstat (limited to 'modules/todo.py')
-rw-r--r--modules/todo.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/modules/todo.py b/modules/todo.py
index ac8293b8..1300cd36 100644
--- a/modules/todo.py
+++ b/modules/todo.py
@@ -31,9 +31,7 @@ class Module(ModuleManager.BaseModule):
todo = event["user"].get_setting("todo", [])
for item in todo:
if item.lower() == arg_lower:
- event["stderr"].write(
- "That is already in your todo")
- return
+ raise utils.EventError("That is already in your todo")
todo.append(event["args"])
event["user"].set_setting("todo", todo)
event["stdout"].write("Saved")
@@ -70,14 +68,12 @@ class Module(ModuleManager.BaseModule):
_from, to = int(_from_str)-1, int(to_str)-1
if _from < 0 or to < 0:
- event["stderr"].write("Both indexes must be above 0")
- return
+ raise utils.EventError("Both indexes must be above 0")
todo = event["user"].get_setting("todo", [])
if _from > len(todo) or to > len(todo):
- event["stderr"].write("Both indexes must be less than the "
+ raise utils.EventError("Both indexes must be less than the "
"size of your todo list")
- return
todo.insert(to, todo.pop(_from))
event["user"].set_setting("todo", todo)