I have error class:
public class FailureException<TRequest, TResponse> : PartialFailureException<TRequest, TResponse>
{
public FailureException(TRequest request, TResponse response, TRequest requestToRetry)
: base(request, response, requestToRetry) { }
}
And then I have different class to detect errors' types:
public static class ErrorDetector
{
public static bool IsFailure(Exception e) =>
e.GetType() == typeof(FailureException<TRequest, TResponse>));
}
Is it possible to somwehow check type of error without adding FailureException<TRequest, TResponse>
(just using FailureException
) so that I wouldn't need to add <TRequest, TResponse> to bunch of other classes?