Consider the following method:
public async Task LoginAsync()
{
if (!CanLoginAsyncExecute()) throw new ValidationException();
try
{
StartLoading();
await _authenticationService.LoginAsync(Email, Password);
}
catch (LoginException e)
{
_logger.Error(e);
throw;
}
catch (ServiceException e)
{
_logger.Error(e);
throw;
}
}
Im having a hard time deciding should I throw my exceptions to the UI layer that calls this method or handle the errors here? It's a personal xamarin project so I could handle the error in the VM (using dialogs or something). Is it a good practice to "silently" handle errors in the business logic layer and rethrow the exceptions? So pretty much if the method doens't throw anything, the login is successful? Or should I be returning a boolean or something to indicate the login was successful?