Also, here is a useful error handler that I'm using in TempHire v2.
public class ErrorHandler : IErrorHandler
{
private readonly IDialogManager _dialogManager;
[ImportingConstructor]
public ErrorHandler(IDialogManager dialogManager)
{
_dialogManager = dialogManager;
}
#region IErrorHandler Members
public void HandleError(Exception ex)
{
string customMessage = null;
if (ex is EntityManagerSaveException &&
((EntityManagerSaveException) ex).FailureType == PersistenceFailure.Concurrency)
customMessage = "Another user has previously saved the current record.";
if (ex is TaskCanceledException)
{
// Log and ignore
LogFns.DebugWriteLine(ex.Message);
return;
}
_dialogManager.ShowMessageAsync(customMessage ?? ex.Message, DialogButtons.Ok);
}
#endregion
}