Commit e7eacacd authored by Jacek Sowiński's avatar Jacek Sowiński

Don't crash on FileNotFoundError with `add -f`

Show descriptive error message instead.
parent b143187e
...@@ -86,10 +86,13 @@ class AddCommand(WriteCommand): ...@@ -86,10 +86,13 @@ class AddCommand(WriteCommand):
self._process_flags() self._process_flags()
if self.from_file: if self.from_file:
new_todos = self.get_todos_from_file() try:
new_todos = self.get_todos_from_file()
for todo in new_todos: for todo in new_todos:
self._add_todo(todo) self._add_todo(todo)
except (IOError, OSError):
self.error('File not found: ' + self.from_file)
else: else:
if self.text: if self.text:
self._add_todo(self.text) self._add_todo(self.text)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment