public void ShowException(IExceptionDetails exception)
        {
            var model = _screenFactory.CreateScreen <IExceptionDetailViewModel>();

            model.Exception = exception;
            _windowManager.ShowDialog(model, true);
        }
        private void ConvertExceptionTree(Exception exception, IExceptionDetails parentExceptionDetails, List <IExceptionDetails> exceptions)
        {
            if (exception == null)
            {
                exception = new Exception(Utils.PopulateRequiredStringValue("message"));
            }

            var exceptionDetails = ExceptionConverter.ConvertToExceptionDetails(exception, parentExceptionDetails);

            // For upper level exception see if Message was provided and do not use exceptiom.message in that case
            if (parentExceptionDetails == null && !string.IsNullOrWhiteSpace(this.Message))
            {
                exceptionDetails.message = this.Message;
            }

            exceptions.Add(exceptionDetails);

            AggregateException aggregate = exception as AggregateException;

            if (aggregate != null)
            {
                foreach (Exception inner in aggregate.InnerExceptions)
                {
                    this.ConvertExceptionTree(inner, exceptionDetails, exceptions);
                }
            }
            else if (exception.InnerException != null)
            {
                this.ConvertExceptionTree(exception.InnerException, exceptionDetails, exceptions);
            }
        }
예제 #3
0
        internal static IExceptionDetails ConvertToExceptionDetails(Exception exception, IExceptionDetails parentExceptionDetails)
        {
            IExceptionDetails exceptionDetails = ExceptionDetails.CreateWithoutStackInfo(exception, parentExceptionDetails);
            var stack = new StackTrace(exception, true);

            var frames = stack.GetFrames();
            Tuple <List <IStackFrame>, bool> sanitizedTuple = SanitizeStackFrame(frames, GetStackFrame, GetStackFrameLength);

            exceptionDetails.parsedStack  = sanitizedTuple.Item1;
            exceptionDetails.hasFullStack = sanitizedTuple.Item2;
            return(exceptionDetails);
        }
예제 #4
0
        public ErrorInformationBase(Exception exception)
        {
            this.Exception = exception;
            if (string.IsNullOrEmpty(this.Message))
            {
                this.Message = exception.Message;
            }
            if (ErrorHandlingUtil.CanShowDebugInfo(this.Exception))
            {
                this.CallStack = this.Exception.ToTraceString();
            }
            IExceptionDetails exceptionDetails = this.Exception as IExceptionDetails;

            if (exceptionDetails != null)
            {
                this.Details = exceptionDetails.Details;
            }
        }
        internal static IExceptionDetails CreateWithoutStackInfo(Exception exception, IExceptionDetails parentExceptionDetails)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            var exceptionDetails = new ExceptionDetails()
            {
                id       = exception.GetHashCode(),
                typeName = exception.GetType().FullName,
                message  = exception.Message
            };

            if (parentExceptionDetails != null)
            {
                exceptionDetails.outerId = parentExceptionDetails.id;
            }

            return(exceptionDetails);
        }
예제 #6
0
 public ExceptionDetailViewModel(IExceptionDetails exception)
 {
     this.Exception = exception;
 }
 public ExceptionDetailViewModel(IExceptionDetails exception)
 {
     this.Exception = exception;
 }