Exemplo n.º 1
0
 /// <summary>
 /// Handles the exception.
 /// </summary>
 /// <param name="errorLocation">The error location.</param>
 /// <param name="exception">The exception.</param>
 public static void HandleException(string errorLocation, Exception exception, int errorCode)
 {
     CommonUtility objCommonUtility = new CommonUtility();
     StringBuilder strExceptionMessage = new StringBuilder();
     strExceptionMessage.AppendLine("This exception has been occurred in the following location >> " + errorLocation);
     strExceptionMessage.AppendLine("Exception:" + exception.Message.ToString() + "<BR>" + exception.StackTrace.ToString());
     //If User does not belong to Active Directory.
     if(errorCode == 5)
     {
         Log.RegisterTraceProvider();
         Log.CategoryType categoryType = Log.CategoryType.Shell_Configurations;
         EventSeverity eventSeverity = EventSeverity.ErrorCritical;
         TraceSeverity traceSeverity = TraceSeverity.High;
         Log.LogMessage(exception.Message.ToString(), errorLocation, categoryType, 10, traceSeverity, eventSeverity, Guid.Empty);
         Log.UnregisterTraceProvider();
     }
     else
     {
         objCommonUtility.SetExceptionSeverity(exception.Message.ToString(), errorLocation);
     }
 }