internal static bool HandleGenericMailboxFailureForMailboxOperation(Util.MethodDelegate methodDelegate, Util.MailboxOperationsErrorHandlingDelegate handleExceptionDelegate) { if (methodDelegate != null) { try { methodDelegate(); return(true); } catch (MailboxUnavailableException ex) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex); } } catch (MailboxInTransitException ex2) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex2); } } catch (MailboxOfflineException ex3) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex3); } } catch (ConnectionFailedPermanentException ex4) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex4); } } catch (StorageTransientException ex5) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex5); } } catch (StoragePermanentException ex6) { if (handleExceptionDelegate != null) { handleExceptionDelegate(ex6); } } return(false); } return(false); }
protected void InvokeMethodAndHandleExceptions(Util.MethodDelegate method) { Util.HandleExceptions(delegate { Exception ex = null; try { method(); } catch (DiscoverySearchPermanentException ex2) { Factory.Current.LocalTaskTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Aggregated Search task failed. DiscoverySearchPermanentException: {1}", this.ExecutingUserIdentity.QueryCorrelationId, ex2.ToString()); ex = ex2; } catch (MultiMailboxSearchException ex3) { Factory.Current.LocalTaskTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Aggregated Search task failed. MultiMailboxSearchException: {1}", this.ExecutingUserIdentity.QueryCorrelationId, ex3.ToString()); ex = ex3; } catch (StoragePermanentException ex4) { Factory.Current.LocalTaskTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Aggregated Search task failed. StorageTransientException: {1}", this.ExecutingUserIdentity.QueryCorrelationId, ex4.ToString()); ex = ex4; } catch (StorageTransientException ex5) { Factory.Current.LocalTaskTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Aggregated Search task failed. StoragePermanentException: {1}", this.ExecutingUserIdentity.QueryCorrelationId, ex5.ToString()); ex = ex5; } catch (ADTransientException ex6) { Factory.Current.LocalTaskTracer.TraceError <Guid, string>((long)this.GetHashCode(), "Correlation Id:{0}. Aggregated Search task failed. ADTransientException: {1}", this.ExecutingUserIdentity.QueryCorrelationId, ex6.ToString()); ex = ex6; } finally { if (ex != null) { AggregatedSearchTaskResult result = (AggregatedSearchTaskResult)this.GetErrorResult(ex); this.callback(this, result); } } }, delegate(GrayException ex) { AggregatedSearchTaskResult result = (AggregatedSearchTaskResult)this.GetErrorResult((ex.InnerException != null) ? ex.InnerException : ex); this.callback(this, result); }); }
internal static void HandleExceptions(Util.MethodDelegate method, Util.GrayExceptionHandler handler) { try { GrayException.MapAndReportGrayExceptions(delegate() { method(); }); } catch (GrayException ex) { Util.SendGrayExceptionWatsonReport(ex.ToString()); handler(ex); } catch (Exception exception) { ExWatson.SendReportAndCrashOnAnotherThread(exception); } }