Skip to content
Snippets Groups Projects
Commit f5483ba8 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

refactor: improves exception handling

* ensure todoPersistence object is not null on all paths
* output ignored exceptions to std err
parent a759da15
Branches
No related tags found
No related merge requests found
...@@ -85,9 +85,12 @@ public class TodoAppController { ...@@ -85,9 +85,12 @@ public class TodoAppController {
reader = new StringReader(todoListWithTwoItems); reader = new StringReader(todoListWithTwoItems);
} }
try { try {
if (todoPersistence != null) {
todoModel = todoPersistence.readTodoModel(reader); todoModel = todoPersistence.readTodoModel(reader);
}
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore
System.err.println(e.toString());
} finally { } finally {
try { try {
if (reader != null) { if (reader != null) {
...@@ -95,6 +98,7 @@ public class TodoAppController { ...@@ -95,6 +98,7 @@ public class TodoAppController {
} }
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore
System.err.println(e.toString());
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment