DevTreks.Exceptions/DevTreksErrors.cs
/// <summary>
/// Static method to publish the exception information.
/// </summary>
/// <param name="exception">The exception object whose information should be published.</param>
/// <param name="errorName">The name of the string resource holding ui error message.</param>
Static method to publish the exception information.
Static method to publish the exception information .
public static string Publish(Exception exception, string errorName, 
            string defaultErrorRootFullPath)
		{
            int iIndex = -1;
            if (errorName != null) iIndex = errorName.IndexOf(STRING_DELIMITER);
			string sFullError = string.Empty;
			if (iIndex != -1) 
			{
				StringBuilder oString = new StringBuilder();
				string[] aMessages = errorName.Split(STRING_DELIMITERS);
				if (aMessages.Length >= 0) 
				{
					oString.Append(GetMessage("TITLE_MESSAGE"));
					oString.Append(aMessages[0]);
					oString.Append(HTML_BREAK);
                    oString.Append(GetMessage("TAB_CLICK_TO_ERASE"));
                    oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 1) 
				{
					oString.Append(GetMessage("TITLE_APPLICATION"));
					oString.Append(aMessages[1]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 2) 
				{
					oString.Append(GetMessage("TITLE_SUBAPPLICATION"));
					oString.Append(aMessages[2]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 3) 
				{
					oString.Append(GetMessage("TITLE_NODENAME"));
					oString.Append(aMessages[3]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 4) 
				{
					oString.Append(GetMessage("TITLE_ID"));
					oString.Append(aMessages[4]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 5) 
				{
					oString.Append(GetMessage("TITLE_SERVICEID"));
					oString.Append(aMessages[5]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 6) 
				{
					oString.Append(GetMessage("TITLE_ACCOUNTID"));
					oString.Append(aMessages[6]);
					oString.Append(HTML_BREAK);
				}
				if (aMessages.Length >= 7) 
				{
					oString.Append(GetMessage("TITLE_FULLMSG"));
					string sAdminMsg = aMessages[7];
					oString.Append(sAdminMsg);
					oString.Append(HTML_BREAK);
					sAdminMsg = string.Empty;
				}
				sFullError = oString.ToString();
			}
			else 
			{
                sFullError = string.Concat(GetMessage("TITLE_MESSAGE"), exception.ToString(), 
                    GetMessage("TAB_CLICK_TO_ERASE"), HTML_BREAK);
			}
            if (Path.IsPathRooted(defaultErrorRootFullPath))
            {
                AppendToErrorLog(sFullError, 2, defaultErrorRootFullPath);
            }
            else
            {
                System.Diagnostics.Trace.TraceInformation("Error '{0}'", sFullError);
            }
			return sFullError;
		}
public static string Publish ( Exception exception , string errorName , string defaultErrorRootFullPath ) { int iIndex = - 1 ; if ( errorName != null ) iIndex = errorName . IndexOf ( STRING_DELIMITER ) ; string sFullError = string . Empty ; if ( iIndex != - 1 ) { StringBuilder oString = new StringBuilder ( ) ; string [ ] aMessages = errorName . Split ( STRING_DELIMITERS ) ; if ( aMessages . Length >= 0 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 0 ] ) ; oString . Append ( HTML_BREAK ) ; oString . Append ( GetMessage ( " " ) ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 1 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 1 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 2 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 2 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 3 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 3 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 4 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 4 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 5 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 5 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 6 ) { oString . Append ( GetMessage ( " " ) ) ; oString . Append ( aMessages [ 6 ] ) ; oString . Append ( HTML_BREAK ) ; } if ( aMessages . Length >= 7 ) { oString . Append ( GetMessage ( " " ) ) ; string sAdminMsg = aMessages [ 7 ] ; oString . Append ( sAdminMsg ) ; oString . Append ( HTML_BREAK ) ; sAdminMsg = string . Empty ; } sFullError = oString . ToString ( ) ; } else { sFullError = string . Concat ( GetMessage ( " " ) , exception . ToString ( ) , GetMessage ( " " ) , HTML_BREAK ) ; } if ( Path . IsPathRooted ( defaultErrorRootFullPath ) ) { AppendToErrorLog ( sFullError , 2 , defaultErrorRootFullPath ) ; } else { System . Diagnostics . Trace . TraceInformation ( " " , sFullError ) ; } return sFullError ; }
Static method to publish the exception information.
Static method to publish the exception information .
//see if the error name is a delimited string //keep 20% of the full error message (don't intimidate the customer too much) //					int iLength = sAdminMsg.Length; //					int iKeepLength = (iLength / 50); //					iLength = iLength - iKeepLength; //					string sKeepMsg = sAdminMsg.Remove(iKeepLength, iLength); //					oString.Append(sKeepMsg); //					sKeepMsg = string.Empty;
exception
Exception
The exception object whose information should be published.
The exception object whose information should be published .
errorName
string
The name of the string resource holding ui error message.
The name of the string resource holding ui error message .
defaultErrorRootFullPath
string