Beispiel #1
0
        private const string _failuretitle = "Attention";         // todo daro think of a better title. Warning? Ooops? Shit?

        public static void HandleError([NotNull] Exception exception,
                                       [CanBeNull] IMsg msg,
                                       [CanBeNull] string title = null)
        {
            Assert.ArgumentNotNull(exception, nameof(exception));

            HandleError(ExceptionUtils.FormatMessage(exception), exception, msg, title);
        }
Beispiel #2
0
        public void CanFormatComExceptionMessage()
        {
            var exception = new COMException("message", 2000);

            string message = ExceptionUtils.FormatMessage(exception);

            Console.WriteLine(message);

            Assert.AreEqual("message\r\n- Error code: 2000", message);
        }
Beispiel #3
0
        public void CanFormatSimpleExceptionMessage()
        {
            var exception = new Exception("message");

            string message = ExceptionUtils.FormatMessage(exception);

            Console.WriteLine(message);

            Assert.AreEqual("message", message);
        }
Beispiel #4
0
        public void CanFormatMessageWithInnerException()
        {
            var inner = new COMException("inner", 2000);
            var outer = new Exception("outer", inner);

            string message = ExceptionUtils.FormatMessage(outer);

            Console.WriteLine(message);

            const string expected = "outer\r\n\r\n---> inner\r\n- Error code: 2000";

            Assert.AreEqual(expected, message);
        }