/// <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); }
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 ExceptionData GetExceptionData(string exceptionType) { //Check to see if maps initialized. If not, do so if (!isInitialized) { Initialize(); } bHelperAvailable = true; if (exceptionRef_ErrorMap != null && exceptionRef_ErrorMap.ContainsKey(exceptionType)) { string sError_id = exceptionRef_ErrorMap[exceptionType]; if (sError_id.StartsWith("GEN") != true) { if (exceptionREF_ExceptionError != null && exceptionREF_ExceptionError.ContainsKey(sError_id)) { exceptionData = new ExceptionData(); exceptionData.BusinessDescription = exceptionREF_ExceptionError[sError_id].BusinessDescription; exceptionData.CodeDescription = exceptionREF_ExceptionError[sError_id].CodeDescription; exceptionData.ExceptionError_id = exceptionREF_ExceptionError[sError_id].ExceptionError_id; exceptionData.ExceptionType = exceptionREF_ExceptionError[sError_id].ExceptionType; exceptionData.ShortDescription = exceptionREF_ExceptionError[sError_id].ShortDescription; } } } if (exceptionData != null) { return(exceptionData); } else { return(null); } }