private static bool Trace(TraceSource trace, TraceVerb verb, TraceNoun noun, Uri entityId, Exception ex) { if (ex is EntityAlreadyExistsException) { trace.StateOperation_Warning(verb, noun, entityId, ex); } else if (ex is not MitigationBailOutException) { trace.StateOperation_Error(verb, noun, entityId, ex); } return(false); }
public static void Trace(TraceSource trace, TraceVerb verb, TraceNoun noun, Uri entityId, Action action) { try { var start = s_timer.Elapsed; action(); var elapsed = s_timer.Elapsed - start; trace.StateOperation_Executed(verb, noun, entityId, (long)elapsed.TotalMilliseconds); } catch (Exception ex) when(Trace(trace, verb, noun, entityId, ex)) { throw; // NB: Unreachable code. } }