public void Constructor_ExceptionWithoutFrames_NoCaptureFrames()
        {
            var exception = new Exception("Exception without stacktrace");
            SentryStacktrace stacktrace = new SentryStacktrace(exception, false);

            Console.WriteLine(exception);

            Assert.That(stacktrace.Frames, Is.Null);
        }
예제 #2
0
        public void Constructor_ExceptionWithFrames_FramesAreAsExpected()
        {
            var exception = TestHelper.GetException();
            SentryStacktrace stacktrace = new SentryStacktrace(exception);

            Console.WriteLine(exception);

            Assert.That(stacktrace.Frames, Is.Not.Null);
            Assert.That(stacktrace.Frames, Has.Length.EqualTo(2));
            Assert.That(stacktrace.Frames[0].Function, Is.EqualTo("PerformDivideByZero"));
            Assert.That(stacktrace.Frames[1].Function, Is.EqualTo("GetException"));
        }
        public void Constructor_ExceptionWithoutFrames_CaptureFrames()
        {
            var exception = new Exception("Exception without stacktrace");
            SentryStacktrace stacktrace = new SentryStacktrace(exception, true);

            Console.WriteLine(exception);

            Assert.That(stacktrace.Frames, Is.Not.Null);
            Assert.That(stacktrace.Frames, Has.Length.GreaterThan(1));
            Assert.That(stacktrace.Frames.Last().Module, Is.Not.StartsWith("SharpRaven.Data"));
            Assert.That(stacktrace.Frames.Last().Function, Is.EqualTo(nameof(Constructor_ExceptionWithoutFrames_CaptureFrames)));
        }
예제 #4
0
                public SentryException(Exception exception)
                {
                    if (exception == null)
                    {
                        return;
                    }

                    Module = exception.Source;
                    Type   = exception.GetType().FullName;
                    Value  = exception.Message;

                    Stacktrace = new SentryStacktrace(exception);
                    if (Stacktrace.Frames == null || Stacktrace.Frames.Length == 0)
                    {
                        Stacktrace = null;
                    }
                }
예제 #5
0
        public void Constructor_NullException_DoesNotThrow()
        {
            SentryStacktrace stacktrace = new SentryStacktrace(null);

            Assert.That(stacktrace.Frames, Is.Null);
        }
예제 #6
0
                public SentryException(Exception exception)
                {
                    if (exception == null)
                        return;

                    Module = exception.Source;
                    Type = exception.GetType().FullName;
                    Value = exception.Message;

                    Stacktrace = new SentryStacktrace(exception);
                    if (Stacktrace.Frames == null || Stacktrace.Frames.Length == 0)
                        Stacktrace = null;
                }