示例#1
0
        protected FeedbackViewModel BuildFeedBackViewModel(Exception ex, IEnumerable <string> modelStateErrors)
        {
            var feedback = new FeedbackViewModel();
            ExceptionHandlingResult exceptionHandlingResult;

            var shouldRethrow = HandleException(ex, out exceptionHandlingResult);

            feedback.Status = shouldRethrow ? FeedbackStatus.Critical : FeedbackStatus.Error;

            feedback.Error = exceptionHandlingResult.ErrorMessage;
            feedback.AddModelStateErrors(modelStateErrors.ToArray());

            //add more exception from exception stack trace
            feedback.AddModelStateErrors(exceptionHandlingResult.ModelStateErrors.ToArray());

            return(feedback);
        }