System.Web.HttpException.FormatFullStackTrace C# (CSharp) Method

FormatFullStackTrace() private method

private FormatFullStackTrace ( ) : string
return string
		string FormatFullStackTrace ()
		{
			Exception ex = this;
			var builder = new StringBuilder ("\r\n<!--");
			string trace;
			string message;
			bool haveTrace, first = true;
			
			while (ex != null) {
				trace = ex.StackTrace;
				message = ex.Message;
				haveTrace = !String.IsNullOrEmpty (trace);
				
				if (!haveTrace && String.IsNullOrEmpty (message)) {
					ex = ex.InnerException;
					continue;
				}

				if (first)
					first = false;
				else
					builder.Append ("\r\n");
				
				builder.Append ("\r\n[" + ex.GetType () + "]: " + HtmlEncode (message) + "\r\n");
				if (haveTrace)
					builder.Append (ex.StackTrace);
				
				ex = ex.InnerException;
			}
			builder.Append ("\r\n-->\r\n");

			return builder.ToString ();
		}