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


C# Exception.GetAllMessages方法代碼示例

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


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

示例1: LogError

        public void LogError(Exception exception) {
            LastError = "Error trying to process manifest.";
            if (exception == null)
                return;

            LogMessages.Add(String.Concat(DateTime.UtcNow.ToShortDateString(), " - ", exception.ToString()));
            LastError = exception.GetAllMessages();
        }
開發者ID:khoussem,項目名稱:Exceptionless,代碼行數:8,代碼來源:Manifest.cs

示例2: LogException

		public static void LogException(Action<string> logger, Exception e, bool addSystemInfo, string msg, params object[] format)
		{
			if (!string.IsNullOrEmpty(msg))
			{
				msg = string.Format(msg, format);
				logger(msg);
			}

			if (e != null)
			{
				LogStacktrace(logger);
				logger("");
				logger(e.ToString());
				//logger(new StackTrace(e, true));
			}

			if (addSystemInfo)
			{
				logger("");
				SystemInfoLogger(logger);
			}

			if (e != null)
			{
				logger("");
				logger(e.GetAllMessages().ToString("\n\t"));
			}

			var evt = ExceptionRaised;
			if (evt != null)
			{
				evt(msg, e);
			}
		}
開發者ID:morz,項目名稱:OETS.Journal,代碼行數:34,代碼來源:LogUtil.cs

示例3: OnCommandFail

 protected override void OnCommandFail(WCell.Util.Commands.CmdTrigger<Squishy.Irc.Commands.IrcCmdArgs> trigger, Exception ex)
 {
     CommandHandler.Msg(Properties.Settings.Default.ErrorChannel, "Exception Occured: " + ex.InnerException.Message);
     foreach (string text in ex.GetAllMessages())
         CommandHandler.Msg(Properties.Settings.Default.ErrorChannel, text);
 }
開發者ID:WCell,項目名稱:WCell-UtilityBot,代碼行數:6,代碼來源:IrcConnection.cs

示例4: ExtensionMethods_GetAllMessages_WhenUnrollingException_ExpectFullExceptionList

        public void ExtensionMethods_GetAllMessages_WhenUnrollingException_ExpectFullExceptionList()
        {
            //------------Setup for test--------------------------
            var innerException = new Exception("Inner Exception");
            var ex = new Exception("Test Error", innerException);
            const string expected = "Test Error\r\nInner Exception";

            //------------Execute Test---------------------------
            var result = ex.GetAllMessages();

            //------------Assert Results-------------------------
            StringAssert.Contains(result, expected);
        }
開發者ID:NatashaSchutte,項目名稱:Warewolf-ESB,代碼行數:13,代碼來源:ExtensionMethodsTest.cs

示例5: OnDBError

		public static void OnDBError(Exception e, string warning)
		{
			try
			{
				// probably a production system - Don't drop.
				if (DBErrorHook != null && !DBErrorHook(e))
				{
					throw e;
				}
			}
			catch (Exception ex)
			{
				log.ErrorException("", ex);
			}

			var errMsg = "Database Error occured";
			LogUtil.ErrorException(e, false, errMsg);
			log.Warn("");
			foreach (var msg in e.GetAllMessages())
			{
				log.Warn(msg);
			}
			log.Warn("");
			log.Warn("Database could not be initialized!");
			log.Warn("Re-create Database schema? (y/n)");
			log.Warn("WARNING: " + warning);

			IsWaiting = true;
			bool doDrop;
			try
			{
				doDrop = StringStream.GetBool(Input.Read());
			}
			catch
			{
				// no Console available (running Tests etc)
				doDrop = true;
			}
			IsWaiting = false;

			if (doDrop)
			{
				log.Warn("Dropping database schema...");
				DropSchema();
				log.Warn("Done.");

				log.Warn("Re-creating database schema...");
				try
				{
					CreateSchema();
				}
				catch (Exception ex)
				{
					// damn it! No console output...
					throw new InvalidOperationException("", ex);
				}
				log.Warn("Done.");
			}
			else
			{
				throw new InvalidOperationException("", e);
			}
		}
開發者ID:KroneckerX,項目名稱:WCell,代碼行數:63,代碼來源:DatabaseUtil.cs

示例6: Error

 public static void Error(string group, Exception exception)
 {
     var message = $"[Error Text]{exception.GetAllMessages()}\r\n[Error Full]{exception}";
     _logger.Log(group, message);
 }
開發者ID:yuandong618,項目名稱:mvcsolution,代碼行數:5,代碼來源:Logger.cs


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