Last active
September 4, 2018 22:17
-
-
Save diego-augusto/17bf7f69d53364972fa7fb1b01622249 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
try | |
{ | |
_unitOfWork.Commit(); | |
} | |
catch (DbEntityValidationException e) | |
{ | |
_logger.Error($"Exception: {e.Message}"); | |
_logger.Error($"Inner: {e.InnerException?.Message}"); | |
_logger.Error($"StackTrace: {e.StackTrace}"); | |
foreach (var entity in e.EntityValidationErrors) | |
{ | |
_logger.Error($"Entity: {entity.Entry.Entity.GetType().Name}"); | |
foreach (var error in entity.ValidationErrors) | |
{ | |
_logger.Error($"PropertyName: {error.PropertyName}"); | |
_logger.Error($"ErrorMessage: {error.ErrorMessage}"); | |
} | |
} | |
} | |
catch (Exception e) | |
{ | |
_logger.Error($"Exception: {e.Message}"); | |
_logger.Error($"Inner: {e.InnerException?.Message}"); | |
_logger.Error($"StackTrace: {e.StackTrace}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment