//Construct matching version public ObjectNotFoundException(string sObjectID, string sRelatedObjectType, string sObjectTypeName, string sFunctionName, string sServiceName, Exception eInner, bool bIsMatchingSearch) : base(ASAException.CreateDetailMessage(BuildMessagePrefix(bIsMatchingSearch), sObjectID, sRelatedObjectType, sObjectTypeName, sFunctionName), sServiceName, eInner) { Debug.Assert(sObjectID != null); Debug.Assert(sObjectTypeName != null); Debug.Assert(sObjectTypeName.Length > 0); Debug.Assert(sFunctionName != null); Debug.Assert(sFunctionName.Length > 0); //_sObjectID = sObjectID; }
/// <param name="exception"> /// The Exception encountered by the ASA Application. /// </param> /// <returns> public ASAException Translate(Exception exception) { errorLookupHelper = new ErrorLookupHelper(); ASAException translatedException = new ASAException(); ExceptionData exceptionData = null; string exceptionType = exception.GetType().ToString();//.Substring(0, 32); if (exceptionType != null) { exceptionData = errorLookupHelper.GetExceptionData(exceptionType); } if (exceptionData != null) { translatedException.BusinessDescription = exceptionData.BusinessDescription; translatedException.CodeDescription = exceptionData.CodeDescription; translatedException.ExceptionType = exceptionData.ExceptionType; translatedException.ShortDescription = exceptionData.ShortDescription; translatedException.ExceptionError_id = exceptionData.ExceptionError_id; } else { if (errorLookupHelper.bHelperAvailable) { translatedException.BusinessDescription = "No Description Found"; translatedException.CodeDescription = "No Description Found"; translatedException.ExceptionType = "ASAUnknownException"; translatedException.ShortDescription = "No Description Found"; translatedException.ExceptionError_id = "GEN0000001"; } else { translatedException.BusinessDescription = "ASA Translation Tables are unavailable"; translatedException.CodeDescription = "ASA Translation Tables are unavailable"; translatedException.ExceptionType = "ASA.ExcErrCodeUnavail"; translatedException.ShortDescription = "ASA Translation Tables are unavailable"; translatedException.ExceptionError_id = "GEN0000002"; } //translatedException.ExceptionError_id = ""; } translatedException.Original_Error_Type = exception.GetType().ToString(); translatedException.Original_Message = exception.GetBaseException().Message; translatedException.Error_call_stack = exception.StackTrace; translatedException.Error_Source = exception.Source; translatedException.Original_Error_Type = exception.GetType().ToString(); return(translatedException); }
/// <summary> /// Method to build translated error to throw when having issue retrieving ref data /// </summary> /// <param name="ex">Original Exception</param> /// <returns>ASAException object that will be translated to SOAP fault</returns> private ASAException handleTablesNotAvailable(Exception ex) { ASAException translatedException = new ASAException(); translatedException.BusinessDescription = "ASA Translation Tables are unavailable"; translatedException.CodeDescription = "ASA Translation Tables are unavailable"; translatedException.ExceptionType = "ASA.ExcErrCodeUnavail"; translatedException.ShortDescription = "ASA Translation Tables are unavailable"; translatedException.ExceptionError_id = "GEN0000002"; translatedException.Original_Error_Type = ex.GetType().ToString(); translatedException.Original_Message = ex.Message; translatedException.Error_call_stack = ex.StackTrace; translatedException.Error_Source = ex.Source; translatedException.Original_Error_Type = ex.GetType().ToString(); return(translatedException); }
public void get_ExceptionErrorMap(ref Dictionary <string, ExceptionData> exceptionREF_ExceptionError, ref Dictionary <string, string> exceptionREF_ExErrorForLookup) { try { List <RefExceptionError> retListExceptionError = new List <RefExceptionError>(); ehProxy.GetReferenceList(ASA.Common.SortDirection.Descending, "ExceptionErrorid", ref retListExceptionError); exceptionREF_ExceptionError = new Dictionary <string, ExceptionData>(); exceptionREF_ExErrorForLookup = new Dictionary <string, string>(); for (int i = 0; i < retListExceptionError.Count; i++) { ExceptionData exceptionError = new ExceptionData(); string sErrorId = retListExceptionError[i].ExceptionErrorid; exceptionError.ExceptionError_id = retListExceptionError[i].ExceptionErrorid; exceptionError.ExceptionType = retListExceptionError[i].CustomExceptionType; exceptionError.ShortDescription = retListExceptionError[i].ErrorShortDescription; exceptionError.CodeDescription = retListExceptionError[i].SystemDescription; if (retListExceptionError[i].BusinessDescription == "") { exceptionError.BusinessDescription = default(string); } else { exceptionError.BusinessDescription = retListExceptionError[i].BusinessDescription; } //create 2 dictionary objects. One for use with ErrorMap (exceptionREF_ExceptionError) //and one to look up and description based on Error Code (exceptionREF_ExErrorForLookup) exceptionREF_ExceptionError.Add(sErrorId, exceptionError); exceptionREF_ExErrorForLookup.Add(sErrorId, exceptionError.BusinessDescription); } } catch (Exception exception) { ASAException translatedException = handleTablesNotAvailable(exception); throw translatedException; } }
public void get_ErrorMap(ref Dictionary <string, string> exceptionRef_ErrorMap) { try { List <ExpErrorMap> retListErrorMap = new List <ExpErrorMap>(); ehProxy.GetReferenceList(ASA.Common.SortDirection.Descending, "ErrorMapid", ref retListErrorMap); exceptionRef_ErrorMap = new Dictionary <string, string>(); for (int i = 0; i < retListErrorMap.Count; i++) { string sysErrorCode = retListErrorMap[i].SystemExceptionType.ToString(); string ASAErrorCode = retListErrorMap[i].ExceptionErrorid; exceptionRef_ErrorMap.Add(sysErrorCode, ASAErrorCode); } } catch (Exception exception) { ASAException translatedException = handleTablesNotAvailable(exception); throw translatedException; } }
// Provide a fault. The Message fault parameter can be replaced, or set to // null to suppress reporting a fault. public void ProvideFault(Exception error, MessageVersion version, ref Message msg) { _mSELDao = (ISELDao)ContextHelper.GetContextObject("SELDAO"); ASAException translatedException = new ASAException(); //catch all, in case error comes into EHF without being translated if (error is ASAException) { translatedException = (ASAException)error; } else { ASAExceptionTranslator afterThrowingTranslator = new ASAExceptionTranslator(); translatedException = afterThrowingTranslator.Translate(error); } string tidCorrelationID = ASATIDHelper.GetTIDCorrelationID(); if (error != null && error is NoMatchingObjectException) { msg = BuildErrorMessage <ASAFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString, translatedException.Error_DetailMessage); } else if (error != null && error is ServiceRequestValidationException) { msg = BuildErrorMessage <ASAFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString + ": " + translatedException.Error_DetailMessage, translatedException.Error_DetailMessage); } else if (error != null && error is ServiceReplyValidationException) { msg = BuildErrorMessage <ASAFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString, translatedException.Error_DetailMessage); } else if (error != null && error is ASADemogBusinessException) { //QC 1690-1693 handle new exception types msg = BuildErrorMessage <ASADemogFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString + ": " + translatedException.Error_DetailMessage, translatedException.Error_DetailMessage); } else if (error != null && error is ASABusinessException) { //QC 1690-1693 handle new exception types msg = BuildErrorMessage <ASABusinessFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString + ": " + translatedException.Error_DetailMessage, translatedException.Error_DetailMessage); } else if (error != null && error is Exception) { switch (translatedException.ExceptionType) { case "ASADataAccessException": case "ASAUnknownException": case "ASA.ExcErrCodeUnavail": { msg = BuildErrorMessage <ASAFaultDetail>(version, "Server", tidCorrelationID, translatedException.BusinessDescription, translatedException.Original_Message); break; } default: { msg = BuildErrorMessage <ASAFaultDetail>(version, "Server", tidCorrelationID, translatedException.Error_FaultString, translatedException.Error_DetailMessage); break; } } } Log.Error(msg); #region add message to the LogException tables string payload = string.Empty; if (Payload.ContainsMessagePayLoad(tidCorrelationID)) { payload = Payload.GetMessagePayLoad(tidCorrelationID); } //LogEvent logEventRec = new LogEvent(); LogException logExceptionRec = new LogException(); logExceptionRec.CreatedBy = (ASATIDHelper.GetTIDUsername() != "") ? ASATIDHelper.GetTIDUsername() : "ASA_USER"; logExceptionRec.CreatedDate = DateTime.Now; logExceptionRec.Payload = payload.ToString(); logExceptionRec.ExceptionStack = error.StackTrace; logExceptionRec.Correlationid = new Guid(tidCorrelationID); logExceptionRec.ExceptionErrorid = translatedException.ExceptionError_id; long eventID; try { //_mSELDao.AddLogExceptionRecord(logExceptionRec, out eventID); Log.Error(payload); Log.Error(logExceptionRec); } catch (Exception ex) { //if there is an error logging the record to the DB, write payload to log file Log.Error(payload); } #endregion }