Skip to content

Commit

Permalink
Refactor try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
irvinlim committed Nov 5, 2016
1 parent 4317579 commit 82aafc7
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/main/java/seedu/todo/controllers/ListController.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,17 @@ public void process(String input) throws ParseException {

boolean isTask = tasksOrEventsBools[0];
boolean isEvent = tasksOrEventsBools[1];

// Filter tasks.
if (isTask) {
try {

try {
if (isTask) {
filteredTasks = CalendarItemFilter.filterTasks(parsedResult);
} catch (InvalidNaturalDateException e) {
System.out.println("Disambiguate: Invalid date format");
return;
}
}

// Filter events.
if (isEvent) {
try {
if (isEvent) {
filteredEvents = CalendarItemFilter.filterEvents(parsedResult);
} catch (InvalidNaturalDateException e) {
System.out.println("Disambiguate: Invalid date format");
return;
}
} catch (InvalidNaturalDateException e) {
System.out.println("Disambiguate: Invalid date format");
return;
}

// Render the new view with filtered tasks.
Expand Down

0 comments on commit 82aafc7

Please sign in to comment.