Q:

How do I return an error message from SendAsync in IIdentityMessageService?

I'm struggling to figure out how to return an error message in my IIdentityMessageService implementation for ASP.NET Identity 2.1, i.e:
Task SendAsync(IdentityMessage message);

When the 2FA code is generated and sent I want to trap if the SMS failed and display the error message:
public async Task<ActionResult> SendCode(SendCodeViewModel model)
..
var token = await this.UserManager.GenerateTwoFactorTokenAsync(userId, model.SelectedProvider);
var result = await this.UserManager.NotifyTwoFactorTokenAsync(userId, model.SelectedProvider, token);

I want the second call to report result.Succeeded == false and allow me to read the error message from result.Errors.
This there a way to do this or am I looking at it the wrong way and should be using a different method to trap any errors on SendAsync?

A:

SendAsync isn't really meant to return error messages right now, you can probably accomplish what you want by throwing and then catching the exception inside of SendCode to display the error you want.

