public SearchExceptionEntry(SearchException exception) { _exception = exception; this.Text = exception.FileSystemInfo.FullName; this.SubItems.Add(exception.FriendlyDescription); }
public void AddLog(Exception objException, ExceptionLogType LogType) { LogController objLogController = new LogController(); LogInfo objLogInfo = new LogInfo(); objLogInfo.LogTypeKey = LogType.ToString(); if (LogType == ExceptionLogType.SEARCH_INDEXER_EXCEPTION) { SearchException objSearchException = (SearchException)objException; objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objSearchException.SearchItem.ModuleId.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("SearchItemId", objSearchException.SearchItem.SearchItemId.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("Title", objSearchException.SearchItem.Title)); objLogInfo.LogProperties.Add(new LogDetailInfo("SearchKey", objSearchException.SearchItem.SearchKey)); objLogInfo.LogProperties.Add(new LogDetailInfo("GUID", objSearchException.SearchItem.GUID)); } else if (LogType == ExceptionLogType.MODULE_LOAD_EXCEPTION) { ModuleLoadException objModuleLoadException = (ModuleLoadException)objException; objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleId", objModuleLoadException.ModuleId.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleDefId", objModuleLoadException.ModuleDefId.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("FriendlyName", objModuleLoadException.FriendlyName)); objLogInfo.LogProperties.Add(new LogDetailInfo("ModuleControlSource", objModuleLoadException.ModuleControlSource)); } else if (LogType == ExceptionLogType.SECURITY_EXCEPTION) { SecurityException objSecurityException = (SecurityException)objException; objLogInfo.LogProperties.Add(new LogDetailInfo("Querystring", objSecurityException.Querystring)); objLogInfo.LogProperties.Add(new LogDetailInfo("IP", objSecurityException.IP.ToString())); } BasePortalException objBasePortalException = new BasePortalException(objException.ToString(), objException); objLogInfo.LogProperties.Add(new LogDetailInfo("AssemblyVersion", objBasePortalException.AssemblyVersion)); objLogInfo.LogProperties.Add(new LogDetailInfo("PortalID", objBasePortalException.PortalID.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("PortalName", objBasePortalException.PortalName)); objLogInfo.LogProperties.Add(new LogDetailInfo("UserID", objBasePortalException.UserID.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("UserName", objBasePortalException.UserName)); objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabID", objBasePortalException.ActiveTabID.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("ActiveTabName", objBasePortalException.ActiveTabName)); objLogInfo.LogProperties.Add(new LogDetailInfo("RawURL", objBasePortalException.RawURL)); objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURL", objBasePortalException.AbsoluteURL)); objLogInfo.LogProperties.Add(new LogDetailInfo("AbsoluteURLReferrer", objBasePortalException.AbsoluteURLReferrer)); objLogInfo.LogProperties.Add(new LogDetailInfo("UserAgent", objBasePortalException.UserAgent)); objLogInfo.LogProperties.Add(new LogDetailInfo("DefaultDataProvider", objBasePortalException.DefaultDataProvider)); objLogInfo.LogProperties.Add(new LogDetailInfo("ExceptionGUID", objBasePortalException.ExceptionGUID)); objLogInfo.LogProperties.Add(new LogDetailInfo("InnerException", objBasePortalException.InnerException.Message)); objLogInfo.LogProperties.Add(new LogDetailInfo("FileName", objBasePortalException.FileName)); objLogInfo.LogProperties.Add(new LogDetailInfo("FileLineNumber", objBasePortalException.FileLineNumber.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("FileColumnNumber", objBasePortalException.FileColumnNumber.ToString())); objLogInfo.LogProperties.Add(new LogDetailInfo("Method", objBasePortalException.Method)); objLogInfo.LogProperties.Add(new LogDetailInfo("StackTrace", objBasePortalException.StackTrace)); objLogInfo.LogProperties.Add(new LogDetailInfo("Message", objBasePortalException.Message)); objLogInfo.LogProperties.Add(new LogDetailInfo("Source", objBasePortalException.Source)); objLogInfo.LogPortalID = objBasePortalException.PortalID; objLogController.AddLog(objLogInfo); }
public virtual void Fail(Exception ex) { Recorder.Trace(2L, TraceType.WarningTrace, "Executor.Fail Error:", ex); this.Context.Failures.Add(ex); Recorder.Record record = this.Policy.Recorder.Start(this.TaskType.Name, TraceType.ErrorTrace, true); SearchException ex2 = ex as SearchException; if (ex2 != null) { record.Attributes["FailError"] = ex2.Error.ToString(); record.Attributes["FailSource"] = ex2.Source; } record.Attributes["EX"] = ex.ToString(); this.Policy.Recorder.End(record); }
/// <summary> /// Validates the search criteria. /// </summary> /// <param name="criteria">The criteria.</param> /// <param name="cultureName">Name of the culture.</param> /// <param name="validationException">The validation exception.</param> /// <returns></returns> public bool ValidateSearchCriteria(SearchCriteriaCollection criteria, string cultureName, out Exception validationException) { validationException = null; if (criteria == null || criteria.Count == 0) { validationException = new SearchException(ComponentsText.ExceptionSearchNoSearchCriteria); return(false); } SearchCriteriaString criteriaProperty; foreach (ISearchCriteria sc in criteria) { criteriaProperty = sc as SearchCriteriaString; if (criteriaProperty != null) { if (StringExpressionKind.RegularExpression == criteriaProperty.WhatKind) { validationException = new SearchException(String.Format(ComponentsText.ExceptionLuceneSearchKindNotSupported, criteriaProperty.WhatKind)); break; // yet a warning } if (StringExpressionKind.XPathExpression == criteriaProperty.WhatKind) { validationException = new SearchException(String.Format(ComponentsText.ExceptionLuceneSearchKindNotSupported, criteriaProperty.WhatKind)); return(false); // error } } } try { if (null == BuildLuceneQuery(criteria, null, GetAnalyzer(cultureName))) { validationException = new SearchException(ComponentsText.ExceptionSearchQueryBuilder); return(false); } } catch (Exception ex) { validationException = new SearchException(String.Format(ComponentsText.ExceptionSearchQueryBuilderFatal, ex.Message), ex); return(false); } return(true); }
public virtual object Process(object item) { Recorder.Trace(2L, TraceType.InfoTrace, "Executor.Process Item:", item); this.EnsureContext(); object output; using (this.Context) { if (this.Context.Input != null || !this.IsEnqueable || this.Context.Output != null) { Recorder.Trace(2L, TraceType.ErrorTrace, new object[] { "Executor.Process Invalid State Input:", this.Context.Input, "Enqueuable:", this.IsEnqueable, "Output:", this.Context.Output }); throw new InvalidOperationException(); } this.Context.Input = item; this.Enqueue(item); this.SignalComplete(); bool flag = this.Context.WaitHandle.WaitOne(this.Policy.ExecutionSettings.SearchTimeout); if (this.Context.FatalException != null) { Recorder.Trace(2L, TraceType.ErrorTrace, "Executor.Process Failed Error:", this.Context.FatalException); throw new SearchException(this.Context.FatalException); } if (!flag) { Recorder.Trace(2L, TraceType.ErrorTrace, "Executor.Process TimedOut"); Exception ex = new SearchException(KnownError.ErrorSearchTimedOut); this.Cancel(ex); throw ex; } Recorder.Trace(2L, TraceType.InfoTrace, "Executor.Process Completed Output:", this.Context.Output); output = this.Context.Output; } return(output); }
public virtual void Cancel(Exception ex) { Recorder.Trace(2L, TraceType.ErrorTrace, "Executor.Cancel Called Error:", ex); if (!this.IsCancelled) { Recorder.Trace(2L, TraceType.ErrorTrace, "Executor.Cancel First Cancel Error:", ex); this.Context.FatalException = ex; this.Context.CancellationTokenSource.Cancel(false); this.AttemptComplete(); } Recorder.Record record = this.Policy.Recorder.Start(this.TaskType.Name, TraceType.FatalTrace, true); SearchException ex2 = ex as SearchException; if (ex2 != null) { record.Attributes["CancelError"] = ex2.Error.ToString(); record.Attributes["CancelSource"] = ex2.Source; } record.Attributes["EX"] = ex.ToString(); this.Policy.Recorder.End(record); }
private void CleanUp(SearchException originalException) { // Release all readers and writers, then release locks SearchException raisedException = originalException; foreach (IndexReader reader in readers.Values) { try { reader.Close(); } catch (IOException e) { if (raisedException != null) { log.Error("Subsequent Exception while closing IndexReader", e); } else { raisedException = new SearchException("Exception while closing IndexReader", e); } } } readers.Clear(); // TODO release lock of all indexes that do not need optimization early // don't optimize if there is a failure if (raisedException == null) { foreach (IDirectoryProvider provider in lockedProviders) { var stats = dpStatistics[provider]; if (!stats.OptimizationForced) { IOptimizerStrategy optimizerStrategy = searchFactoryImplementor.GetOptimizerStrategy(provider); optimizerStrategy.AddTransaction(stats.Operations); try { optimizerStrategy.Optimize(this); } catch (SearchException e) { raisedException = new SearchException("Exception whilst optimizing directoryProvider: " + provider.Directory, e); break; // No point in continuing } } } } foreach (IndexWriter writer in writers.Values) { try { writer.Close(); } catch (IOException e) { if (raisedException != null) { log.Error("Subsequent Exception while closing IndexWriter", e); } else { raisedException = new SearchException("Exception while closing IndexWriter", e); } } } foreach (IDirectoryProvider provider in lockedProviders) { object syncLock = searchFactoryImplementor.GetLockableDirectoryProviders()[provider]; Monitor.Exit(syncLock); } writers.Clear(); lockedProviders.Clear(); dpStatistics.Clear(); if (raisedException != null) { throw raisedException; } }