/// <summary> /// Add an exception to our list of exceptions. /// </summary> /// <param name="err">The exception to add.</param> private void AddException(Exception err) { if (err != null) { if (ExceptionsThrown == null) { ExceptionsThrown = new List <Exception>(); } ExceptionsThrown.Add(err); } }
protected override Response GetCachedResponseFor(Request request, string region) { var cachedResponse = base.GetCachedResponseFor(request, region); requestsReceived.Add(request); returnedCachedResponses.Add(cachedResponse); // WORKAROUND : // handler not called adding null to ExceptionsThrown here to avoid hard lookups later. if (cachedResponse != null) { ExceptionsThrown.Add(null); } return(cachedResponse); }
public static bool Threw <TException>() { return(ExceptionsThrown.Any(e => e != null && e.GetType() == typeof(TException))); }
public static int GetIndexOfFirstExceptionThrown <TException>() { return(ExceptionsThrown.FindIndex(e => e != null && e.GetType() == typeof(TException))); }
public static int GetIndexOfFirstExceptionThrown() { return(ExceptionsThrown.FindIndex(e => e != null)); }
public Response CreateDefaultResponse() { DefaultResponseReturned++; ExceptionsThrown.Add(null); return(new Response()); }