Last active
June 15, 2018 22:44
-
-
Save FraukeN/c700e1fb9973cf8e51c957299ade1f58 to your computer and use it in GitHub Desktop.
OverviewVM new LoadData with exception handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public OverviewVM(IRepository<ToDoItem> toDoRepo) | |
{ | |
_toDoRepo = toDoRepo ?? throw new ArgumentNullException("toDoRepo"); | |
IsFaulted = false; | |
ErrorMessage = string.Empty; | |
} | |
public async Task LoadData() | |
{ | |
try | |
{ | |
ToDoItems = await _toDoRepo.GetAsync(); | |
IsFaulted = false; | |
ErrorMessage = string.Empty; | |
} | |
catch (Exception) | |
{ | |
IsFaulted = true; | |
ErrorMessage = "Unable to Load ToDo Items"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment