當前位置: 首頁>>代碼示例>>C#>>正文


C# Exception.BuildExceptionMessage方法代碼示例

本文整理匯總了C#中System.Exception.BuildExceptionMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# Exception.BuildExceptionMessage方法的具體用法?C# Exception.BuildExceptionMessage怎麽用?C# Exception.BuildExceptionMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Exception的用法示例。


在下文中一共展示了Exception.BuildExceptionMessage方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Error

		public void Error(Exception exception, string message = null)
		{
            if(String.IsNullOrEmpty(message))
            {
                message = exception.BuildExceptionMessage();
            }
			_logger.Error(exception, message);
		}
開發者ID:jcanady20,項目名稱:Scheduler.Service,代碼行數:8,代碼來源:NLogger.cs

示例2: GivenNoMessageInformation_WhenIFormatTheMessage_ThenTheMessageFormatShouldBeCorrect

        public void GivenNoMessageInformation_WhenIFormatTheMessage_ThenTheMessageFormatShouldBeCorrect()
        {
            string message = "A message";
            var e = new Exception(message);

            string expected = "Message: " + message + Environment.NewLine
                              + "Source: " + e.Source + Environment.NewLine
                              + "Stack Trace: " + e.StackTrace + Environment.NewLine
                              + "Target Site: " + e.TargetSite;

            string actual = e.BuildExceptionMessage(null);
            Assert.That(actual, Is.EqualTo(expected));
        }
開發者ID:kevinrjones,項目名稱:mblog,代碼行數:13,代碼來源:TestExceptionFormatter.cs

示例3: GivenAMessageInformation_WhenIFormatTheMessage_ThenTheMessageFormatShouldBeCorrect

        public void GivenAMessageInformation_WhenIFormatTheMessage_ThenTheMessageFormatShouldBeCorrect()
        {
            string message = "A message";
            string path = "A path";
            string rawUrl = "A Url";
            var messageInformationMock = new Mock<IMessageInformation>();
            messageInformationMock.Setup(m => m.Path).Returns(path);
            messageInformationMock.Setup(m => m.RawUrl).Returns(rawUrl);

            var e = new Exception(message);

            string expected = "Error in Path: " + path + Environment.NewLine
                              + "Raw Url: " + rawUrl + Environment.NewLine
                              + "Message: " + message + Environment.NewLine
                              + "Source: " + e.Source + Environment.NewLine
                              + "Stack Trace: " + e.StackTrace + Environment.NewLine
                              + "Target Site: " + e.TargetSite;

            string actual = e.BuildExceptionMessage(messageInformationMock.Object);
            Assert.That(actual, Is.EqualTo(expected));
        }
開發者ID:kevinrjones,項目名稱:mblog,代碼行數:21,代碼來源:TestExceptionFormatter.cs

示例4: Fatal

 public void Fatal(Exception x, string path, string url)
 {
     Fatal(x.BuildExceptionMessage(path, url));
 }
開發者ID:kevinrjones,項目名稱:Itsa,代碼行數:4,代碼來源:NLogLogger.cs

示例5: Error

 public void Error(Exception x, string path, string url)
 {
     Error(x.BuildExceptionMessage(path, url));
 }
開發者ID:kevinrjones,項目名稱:Itsa,代碼行數:4,代碼來源:NLogLogger.cs

示例6: Fatal

		public void Fatal(Exception x)
		{
			_logger.Fatal(x, x.BuildExceptionMessage());
		}
開發者ID:jcanady20,項目名稱:Scheduler.Service,代碼行數:4,代碼來源:NLogger.cs

示例7: Fatal

 public void Fatal(Exception ex)
 {
     logger.Fatal(ex.BuildExceptionMessage());
 }
開發者ID:nghiemhd,項目名稱:Libs,代碼行數:4,代碼來源:Logger.cs

示例8: Error

 public void Error(Exception ex)
 {
     logger.Error(ex.BuildExceptionMessage());
 }
開發者ID:nghiemhd,項目名稱:Libs,代碼行數:4,代碼來源:Logger.cs

示例9: Fatal

 public void Fatal(Exception x)
 {
     Fatal(x.BuildExceptionMessage());
 }
開發者ID:ApiNetworks,項目名稱:iAFWeb,代碼行數:4,代碼來源:LogService.cs

示例10: Error

 public void Error(Exception x)
 {
     Error(x.BuildExceptionMessage());
 }
開發者ID:ApiNetworks,項目名稱:iAFWeb,代碼行數:4,代碼來源:LogService.cs

示例11: Error

 public void Error(Exception x)
 {
     _logger.Error(x, x.BuildExceptionMessage(), null);
 }
開發者ID:jcanady20,項目名稱:ReportHost,代碼行數:4,代碼來源:NLogger.cs


注:本文中的System.Exception.BuildExceptionMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。